forked from xnning/Dissertation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packages.tex
379 lines (311 loc) · 10.3 KB
/
packages.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
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Some of my favourite personal adjustments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% These are the adjustments that I consider necessary for typesetting
% a nice thesis. However, they are *not* included in the template, as
% I do not want to force you to use them.
% This ensures that I am able to typeset bold font in table while still aligning the numbers
% correctly.
\usepackage{etoolbox}
\usepackage{enumerate}
\usepackage[binary-units=true]{siunitx}
\DeclareSIUnit\px{px}
\sisetup{%
detect-all = true,
detect-family = true,
detect-mode = true,
detect-shape = true,
detect-weight = true,
detect-inline-weight = math,
}
\newcommand{\overbar}[1]{\mkern 1.5mu\overline{\mkern-1.5mu#1\mkern-1.5mu}\mkern 1.5mu}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Hyperlinks & bookmarks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[%
colorlinks = true,
citecolor = black,
linkcolor = RoyalBlue,
urlcolor = black,
backref = page
]{hyperref}
\usepackage[capitalise]{cleveref}
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{%
\ifcase #1%
\or [cited on page~#2]%
\else [cited on pages~#2]%
\fi%
}
% add line number
% \usepackage{lineno}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bibliography
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[sort]{natbib}
\setcitestyle{%
authoryear,%
open={[},close={]},citesep={;},%
aysep={},yysep={,},%
notesep={, }}
% Explain list of backreferences.
% https://tex.stackexchange.com/a/70953/1340
\renewcommand{\bibpreamble}{%
[Citing pages are listed after each reference.]%
\par\bigskip}
% ACM bibliography style looks more professional
\bibliographystyle{ACM-Reference-Format}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fonts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifxetexorluatex
\setmainfont{Minion Pro}
\else
\usepackage[lf]{ebgaramond}
\usepackage[oldstyle,scale=0.7]{sourcecodepro}
\singlespacing
\fi
\renewcommand{\th}{\textsuperscript{\textup{th}}\xspace}
\usepackage{xeCJK}
% \setCJKmainfont{喜鹊聚珍体}
% \newacronym[description={Principal component analysis}]{PCA}{PCA}{principal component analysis}
% \newacronym {SNF}{SNF}{Smith normal form}
% \newacronym[description={Topological data analysis}] {TDA}{TDA}{topological data analysis}
% \newglossaryentry{LaTeX}{%
% name = {\LaTeX},
% description = {A document preparation system},
% sort = {LaTeX},
% }
% \newglossaryentry{Real numbers}{%
% name = {$\real$},
% description = {The set of real numbers},
% sort = {Real numbers},
% }
% \makeindex
% \makeglossaries
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load up my personal packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{metalogo}
% Basics
\usepackage{fixltx2e}
\usepackage{url}
\usepackage{fancyvrb}
\usepackage{mdwlist} % Miscellaneous list-related commands
\usepackage{bookmark}
% https://www.nesono.com/?q=book/export/html/347
% Package for inserting TODO statements in nice colorful boxes - so that you
% won’t forget to fix/remove them. To add a todo statement, use something like
% \todo{Find better wording here}.
\usepackage{todonotes}
%% Math
\usepackage{ latexsym }
\usepackage{bm} % Bold symbols in maths mode
\usepackage{amssymb}
% http://tex.stackexchange.com/questions/114151/how-do-i-reference-in-appendix-a-theorem-given-in-the-body
\usepackage{thmtools, thm-restate}
%% Theoretical computer science
\usepackage{stmaryrd}
\usepackage{mathtools} % For "::=" ( \Coloneqq )
%% Font
% \usepackage[euler-digits,euler-hat-accent]{eulervm}
\usepackage{pifont}
\usepackage{textgreek}
\usepackage{savesym}
\savesymbol{checkmark}
\usepackage{dingbat}
\usepackage{comment}
\usepackage{longtable}
\usepackage{tikz-cd}
\usetikzlibrary{babel}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{petri,topaths}
\usepackage{tkz-berge}
% Code highlighting
\usepackage{listings}
\lstset{%
% backgroundcolor=\color{white},
basicstyle=\small\ttfamily,
keywordstyle=\sffamily\bfseries,
captionpos=none,
columns=flexible,
keepspaces=true,
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
breaklines=true, % sets automatic line breaking
breakatwhitespace=true, % sets if automatic breaks should only happen at whitespace
escapeinside={(*}{*)},
literate={lam}{{$\lambda$}}1 {->}{{$\rightarrow$}}1 {Top}{{$\top$}}1 {o+o}{{$\oplus$}}1 {=>}{{$\Rightarrow$}}1 {/\\}{{$\Lambda$}}1 {forall}{{$\forall$}}1,
tabsize=2,
commentstyle=\color{purple}\ttfamily,
stringstyle=\color{red}\ttfamily,
sensitive=false
}
\lstdefinelanguage{sedel}{
keywords={main, Int, String, Bool, self, Void, Class, All, extends, this, trait, inherits, super, type, Trait, override, new, if, then, else, let, in, letrec},
identifierstyle=\color{black},
morecomment=[l]{--},
morecomment=[l]{//},
morestring=[b]",
xleftmargin = 3mm,
morestring=[b]'
}
\lstdefinelanguage{simple}{
keywords={letrec, in, let},
identifierstyle=\color{black},
xleftmargin = 3mm,
}
\lstdefinelanguage{gbeta}{%
language = java,
morekeywords = {virtual,refine},
xleftmargin = 3mm
}
\lstdefinelanguage{JavaScript}{
keywords={function, const, extends, super, class, export, boolean, throw, implements, import, this, typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},
identifierstyle=\color{black},
comment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]',
xleftmargin = 3mm,
morestring=[b]"
}
\lstset{language=sedel}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{conjecture}[theorem]{Conjecture}
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}
\newtheorem{observation}{Observation}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Ott includes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{ottalt}
\inputott{Gen/ott-rules}
\renewcommand\ottaltinferrule[4]{
\inferrule*[narrower=0.6,lab=#1,#2]
{#3}
{#4}
}
%%----------------------------------------------------------------------------%%
%%----------------------------------------------------------------------------%%
%% Environment for Title Page %%
%%----------------------------------------------------------------------------%%
\makeatletter
\renewcommand{\maketitle}
{%
\begin{titlepage}
\renewcommand{\baselinestretch}{1}
\begin{center}
\vspace*{\stretch{3}}
{\LARGE\@title\par}
\vspace*{1cm}
{\large\textit{by}\par}
\vspace*{1cm}
{\Large\@author\par}
{\Large(谢宁宁)\par}
\vspace*{\stretch{5}}
{{\includegraphics[width=30mm]{figures/hku}} \par}
{\hbox{}\par}
\vspace*{\stretch{5}}
{
% \textsl{(Temporary Binding for Examination Purposes)} \\
% \vspace*{3cm}
{\normalsize
A thesis submitted in partial fulfillment of the requirements for \\
the degree of Doctor of Philosophy \\
at The University of Hong Kong \\
\par
}
}
\vspace*{\stretch{1}}
{\large\@date\par}
\vspace*{\stretch{1}}
\end{center}
\end{titlepage}
} \makeatother
%%----------------------------------------------------------------------------%%
%% Environment for Abstract %%
%%----------------------------------------------------------------------------%%
\makeatletter
\newenvironment{abstract}%
{
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse\newpage
\fi
\pagestyle{empty}%
\setcounter{page}\@ne
\mbox{}
\newpage
\pagestyle{empty}%
\setcounter{page}\@ne
\cleardoublepage
\begin{center}
\large
Abstract of thesis entitled \par
\textbf{``\@title''} \par
\vspace*{0.2in}
Submitted by \par
\@author \par
\vspace*{0.2in}
for the degree of Doctor of Philosophy \\
at The University of Hong Kong \\
in \@date
\end{center}
\vspace*{0.5in}
}%
{
\if@restonecol\twocolumn \else \newpage \fi
\if@twoside\else
\setcounter{page}\@ne
\fi
}
\makeatother
%%----------------------------------------------------------------------------%%
%% Environment for Declaration %%
%%----------------------------------------------------------------------------%%
\makeatletter
\newcommand{\makedeclaration}
{
\chapter*{Declaration}
\addcontentsline{toc}{chapter}{Declaration}
\noindent I declare that this thesis represents my own work, except
where due acknowledgment is made, and that it has not been
previously included in a thesis, dissertation or report submitted
to this University or to any other institution for a degree,
diploma or other qualifications.
\vspace*{1.5in}
\noindent%
\begin{tabular}{@{}l@{}}
\dotfill \\
\@author\hspace*{3cm}\\
\@date\\
\end{tabular}
}
\makeatother
%%----------------------------------------------------------------------------%%
%% Environment for Acknowledgments %%
%%----------------------------------------------------------------------------%%
\makeatletter
\newcommand{\makeAck}
{
\chapter*{Acknowledgments}
\addcontentsline{toc}{chapter}{Acknowledgments}
\input{acknowledgment}
}
\makeatother
\KOMAoptions{listof=totoc}
% \setkomafont{sectioning}{\normalfont\bfseries}