/
preamble.tex
executable file
·98 lines (83 loc) · 2.93 KB
/
preamble.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
\usepackage{booktabs}
\usepackage{longtable}
\renewcommand{\figurename}{Figure}
\renewcommand{\tablename}{Table}
\usepackage{framed,color}
\definecolor{shadecolor}{RGB}{242,242,242}
\renewcommand{\textfraction}{0.05}
\renewcommand{\topfraction}{0.8}
\renewcommand{\bottomfraction}{0.8}
\renewcommand{\floatpagefraction}{0.75}
\raggedbottom
% tweak deafult fonts
\usepackage{fontspec}
\usepackage{xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setmonofont[Mapping=tex-ansi]{Inconsolata}
% Chinese fonts
\usepackage{xeCJK}
% box drawing characters
% <https://tex.stackexchange.com/a/333210/6444>
\usepackage{newunicodechar}
\newfontfamily{\fallbackfont}{Andale Mono}
\DeclareTextFontCommand{\textfallback}{\fallbackfont}
\newunicodechar{█}{\textfallback{█}}
\newunicodechar{└}{\textfallback{└}}
\newunicodechar{─}{\textfallback{─}}
\newunicodechar{├}{\textfallback{├}}
\newunicodechar{│}{\textfallback{│}}
% Place links inline
\let\oldhref\href
\renewcommand{\href}[2]{#2 (\url{#1})}
\makeatletter
\newenvironment{kframe}{%
\medskip{}
\setlength{\fboxsep}{.8em}
\def\at@end@of@kframe{}%
\ifinner\ifhmode%
\def\at@end@of@kframe{\end{minipage}}%
\begin{minipage}{\columnwidth}%
\fi\fi%
\def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
\colorbox{shadecolor}{##1}\hskip-\fboxsep
% There is no \\@totalrightmargin, so:
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
\MakeFramed {\advance\hsize-\width
\@totalleftmargin\z@ \linewidth\hsize
\@setminipage}}%
{\par\unskip\endMakeFramed%
\at@end@of@kframe}
\makeatother
\renewenvironment{Shaded}{\begin{kframe}}{\end{kframe}}
\renewenvironment{quote}%
{\list{}{\leftmargin=0.5in\rightmargin=0.5in}\item[]\begin{itshape}}%
{\end{itshape}\endlist}
% % Colour
\renewcommand{\KeywordTok} [1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
\renewcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
\renewcommand{\DecValTok} [1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\renewcommand{\BaseNTok} [1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\renewcommand{\FloatTok} [1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
\renewcommand{\CharTok} [1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\renewcommand{\StringTok} [1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
\renewcommand{\CommentTok} [1]{\textcolor[rgb]{0.38,0.63,0.69}{{#1}}}
\renewcommand{\OtherTok} [1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
\renewcommand{\AlertTok} [1]{\textcolor[rgb]{1.00,0.00,0.00}{{#1}}}
\renewcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
\renewcommand{\ErrorTok} [1]{\textcolor[rgb]{1.00,0.00,0.00}{{#1}}}
\renewcommand{\NormalTok} [1]{{#1}}
% No widow lines
\widowpenalty=10000
\clubpenalty=10000
\usepackage{makeidx}
\newcommand{\indexc}[1]{\index{#1@\texttt{#1}}}
\makeindex
\urlstyle{tt}
\usepackage{amsthm}
\makeatletter
\def\thm@space@setup{%
\thm@preskip=8pt plus 2pt minus 4pt
\thm@postskip=\thm@preskip
}
\makeatother
\frontmatter