forked from liuxinyu95/AlgoXY
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common-en.tex
132 lines (116 loc) · 3.63 KB
/
common-en.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
%
% loading packages
%
\RequirePackage{ifpdf}
\RequirePackage{ifxetex}
%
%
\ifpdf
\RequirePackage[pdftex,%
bookmarksnumbered,%
colorlinks,%
linkcolor=blue,%
hyperindex,%
plainpages=false,%
pdfstartview=FitH]{hyperref}
\else\ifxetex
\RequirePackage[bookmarksnumbered,%
colorlinks,%
linkcolor=blue,%
hyperindex,%
plainpages=false,%
pdfstartview=FitH]{hyperref}
\else
\RequirePackage[dvipdfm,%
bookmarksnumbered,%
colorlinks,%
linkcolor=blue,%
hyperindex,%
plainpages=false,%
pdfstartview=FitH]{hyperref}
\fi\fi
%\usepackage{hyperref}
% other packages
%--------------------------------------------------------------------------
\usepackage{graphicx, color}
\usepackage{subfig}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\usepackage{amsmath, amsthm, amssymb} % for math
\usepackage{exercise} % for exercise
\usepackage{import} % for nested input
%
% for programming
%
\usepackage{verbatim}
\usepackage{listings}
%\usepackage{algorithmic} %old version; we can use algorithmicx instead
\usepackage{algorithm}
\usepackage[noend]{algpseudocode} %for pseudo code, include algorithmicsx automatically
\usepackage{appendix}
\usepackage{makeidx} % for index support
\usepackage{titlesec}
\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\lstdefinelanguage{Smalltalk}{
morekeywords={self,super,true,false,nil,thisContext}, % This is overkill
morestring=[d]',
morecomment=[s]{"}{"},
alsoletter={\#:},
escapechar={!},
literate=
{BANG}{!}1
{UNDERSCORE}{\_}1
{\\st}{Smalltalk}9 % convenience -- in case \st occurs in code
% {'}{{\textquotesingle}}1 % replaced by upquote=true in \lstset
{_}{{$\leftarrow$}}1
{>>>}{{\sep}}1
{^}{{$\uparrow$}}1
{~}{{$\sim$}}1
{-}{{\sf -\hspace{-0.13em}-}}1 % the goal is to make - the same width as +
%{+}{\raisebox{0.08ex}{+}}1 % and to raise + off the baseline to match -
{-->}{{\quad$\longrightarrow$\quad}}3
, % Don't forget the comma at the end!
tabsize=2
}[keywords,comments,strings]
% for better Haskell code outlook
\lstdefinelanguage{Haskell}{
basicstyle=\small\ttfamily,
flexiblecolumns=false,
basewidth={0.5em,0.45em},
literate={+}{{$+$}}1 {/}{{$/$}}1 {*}{{$*$}}1 {=}{{$=$}}1
{>}{{$>$}}1 {<}{{$<$}}1 {\\}{{$\lambda$}}1
{\\\\}{{\char`\\\char`\\}}1
{->}{{$\rightarrow$}}2 {>=}{{$\geq$}}2 {<-}{{$\leftarrow$}}2
{<=}{{$\leq$}}2 {=>}{{$\Rightarrow$}}2
{\ .}{{$\circ$}}2 {\ .\ }{{$\circ$}}2
{>>}{{>>}}2 {>>=}{{>>=}}2
{|}{{$\mid$}}1
}[keywords,comments,strings]
\lstloadlanguages{C, C++, Lisp, Haskell, Python, Smalltalk}
\lstset{
showstringspaces = false
}
% ======================================================================
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
%
% mathematics
%
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\bmat}[1]{\left( \begin{array}{#1} }
\newcommand{\emat}{\end{array} \right) }
\newcommand{\VEC}[1]{\mbox{\boldmath $#1$}}
% numbered equation array
\newcommand{\bea}{\begin{eqnarray}}
\newcommand{\eea}{\end{eqnarray}}
% equation array not numbered
\newcommand{\bean}{\begin{eqnarray*}}
\newcommand{\eean}{\end{eqnarray*}}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}