-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbkc.sty
247 lines (209 loc) · 7.32 KB
/
bkc.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
%% bkc.sty (The personal TeX style of bkc39)
%%
%% version 3
%% Aug 3, 2013
\ProvidesPackage{bkc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Package Imports %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Standard AMS packages
\RequirePackage{amsfonts}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\RequirePackage{mathrsfs} % for mathscr font. Munkres style
\RequirePackage{mathtools}
%% For TikZ
\RequirePackage{xspace}
\RequirePackage{tikz}
\RequirePackage{tikz-cd}
%% For algorithms
\RequirePackage{algorithm}
\RequirePackage{algorithmicx}
\RequirePackage{algpseudocode}
%% For code
\RequirePackage{alltt}
\RequirePackage{listings}
\RequirePackage{pxfonts}
\RequirePackage[T1]{fontenc}
\RequirePackage{esint} % math compatibility with pxfonts
%% For PL typesetting
\RequirePackage{proof}
%% Links
\RequirePackage{hyperref}
\hypersetup{
colorlinks,
linkcolor=blue
}
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\newcommand{\tab}{\hspace*{2em}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MATH MACROS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO:
% - draw common shapes in tikz?
% - common special functions: bessel, gamma, zeta, hypergeometric, ...
% - macros for common categories Ab,Grp,Top,Rng,CmpHaus, ...
% - tikzcd shortcut for the usual commutative triangle
%% Commonly used sets
\DeclareMathOperator{\N}{\ensuremath{\mathbf{N}}}
\DeclareMathOperator{\Z}{\ensuremath{\mathbf{Z}}}
\DeclareMathOperator{\Q}{\ensuremath{\mathbf{Q}}}
\DeclareMathOperator{\R}{\ensuremath{\mathbf{R}}}
\DeclareMathOperator{\Hu}{\ensuremath{\mathbf{H}}}
\DeclareMathOperator{\Oc}{\ensuremath{\mathbf{O}}}
\DeclareMathOperator{\F}{\ensuremath{\mathbf{F}}}
\DeclareMathOperator{\D}{\ensuremath{\mathbf{D}}}
\DeclareMathOperator{\T}{\ensuremath{\mathbf{T}}}
\DeclareMathOperator{\C}{\ensuremath{\mathbf{C}}}
%% For declaring sets
\DeclareMathOperator{\suchthat}{\mathrel{:}} % some people like \vert better
\newcommand{\defset}[2]{\left\{#1 \suchthat #2\right\}}
%% Function notation
\DeclareMathOperator{\into}{\hookrightarrow}
\DeclareMathOperator{\onto}{\twoheadrightarrow}
\DeclareMathOperator{\bij}{\leftrightarrow}
\DeclareMathOperator{\of}{\circ}
%% Some arrow shortcuts
\DeclareMathOperator{\ua}{\uparrow}
\DeclareMathOperator{\da}{\downarrow}
\DeclareMathOperator{\la}{\leftarrow}
\DeclareMathOperator{\lla}{\longleftarrow}
\DeclareMathOperator{\lra}{\longrightarrow}
%% Logic
\newenvironment{logic}
{\renewcommand{\and}{\ensuremath{\land}}
\renewcommand{\or}{\ensuremath{\lor}}
\renewcommand{\not}{\ensuremath{\lnot}}}
{}
\renewcommand{\implies}{\ensuremath{\mathrel{\Rightarrow}}}
\renewcommand{\iff}{\ensuremath{\mathrel{\Leftrightarrow}}}
%% Number Theory
\DeclareMathOperator{\divides}{\ensuremath{\mathrel{\mid}}}
\DeclareMathOperator{\ndivides}{\ensuremath{\mathrel{\nmid}}}
\newcommand{\ceil}[1]{\left\lceil #1\right\rceil}
\newcommand{\floor}[1]{\left\lfloor #1\right\rfloor}
\newcommand{\leg}[2]{\left(#1\mid #2\right)} % Legendre symbol
%% Analysis Macros
\newcommand{\sder}[2]{\frac{d #1}{d #2}}
\newcommand{\der}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\norm}[1]{\|#1\|}
\newcommand{\lpnorm}[2]{\|#1\|_{L^{#2}}}
\newcommand{\diam}[1]{\text{diam}(#1)}
\newcommand{\seq}[2]{\{#1_{#2}\}_{#2 = 1}^\infty}
\DeclareMathOperator{\lap}{\bigtriangleup} % the laplacian symbol
% For the Characteristic function of a set. A capital Chi.
\DeclareMathOperator{\capchi}{\raisebox{2pt}
{$\mathlarger{\mathlarger{\chi}}$}}
%% Complex Analysis
\newcommand{\real}{\mathrel{\text{Re}}}
\newcommand{\imag}{\mathrel{\text{Im}}}
\newcommand{\conj}[1]{\overline{#1}}
\newcommand{\cis}[1]{\operatorname{cis}#1}
\newcommand{\res}{\operatorname{res}}
%% Algebra
\DeclareMathOperator{\free}{\raisebox{-2pt}{\scalebox{2.5}{$\ast$}}}
\DeclareMathOperator{\normal}{\unlhd}
\DeclareMathOperator{\im}{\text{im}}
\DeclareMathOperator{\coim}{\text{coim}}
\DeclareMathOperator{\coker}{\text{coker}}
\DeclareMathOperator{\trace}{\text{tr}}
\newcommand{\iso}{\cong}
\newcommand{\cat}[1]{\textbf{#1}}
\newcommand{\aut}[1]{\text{Aut}(#1)}
\newcommand{\gal}[1]{\text{Gal}(#1)}
%% Vector Calculus
\newcommand{\normalvec}{\ensuremath{\vec{n}}}
\newcommand{\grad}{\ensuremath{\nabla}}
\newcommand{\divv}{\ensuremath{\nabla \cdot}}
\DeclareMathOperator{\curl}{\text{curl}}
%% Statistics
\newcommand{\cov}[2]{\ensuremath{\mathrm{cov}(#1,#2)}}
\newcommand{\corr}[2]{\ensuremath{\mathrm{corr}(#1,#2)}}
\newcommand{\pr}[1]{\ensuremath{\mathrm{Pr}\left(#1\right)}}
\newcommand{\E}[1]{\ensuremath{\mathrm{\mathbf{E}}\left[#1\right]}}
%% Theorem environments. Lose auto-numbering for problem sets.
\newtheorem*{thm}{\\ Theorem}
\newtheorem*{lem}{\\ Lemma}
\newtheorem*{claim}{\\ Claim}
\newtheorem*{defn}{\\ Definition}
\newtheorem*{prop}{\\ Proposition}
%% Theorem environments with auto-numbering for notes
\newtheorem{nthm}{Theorem}
\newtheorem{nlem}{Lemma}
\newtheorem{nclaim}{Claim}
\newtheorem{ndefn}{Definition}
\newtheorem{nprop}{Proposition}
\newtheorem{nexample}{Example}
\newtheorem{nproblem}{Problem}
%% For TikZ
\usetikzlibrary{shapes}
\usetikzlibrary{arrows}
\usetikzlibrary{fit}
\usetikzlibrary{backgrounds}
\usetikzlibrary{shadows}
\usetikzlibrary{matrix}
\usetikzlibrary{calc}
\usetikzlibrary{trees}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CS MACROS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% NP-completeness stuff
\newcommand{\np}{\text{NP}}
\newcommand{\npc}{\text{NP-complete}}
\renewcommand{\sc}[1]{\textsc{#1}}
%% For Typesetting OCaml
\lstnewenvironment{ocaml}{
\lstset{
language=[Objective] Caml,
basicstyle=\small\ttfamily,
keywordstyle=\bfseries,
breaklines=true,
morekeywords={raise}
}
}{}
\newcommand{\caml}{
\lstinline[
language=[Objective] Caml,
basicstyle=\small\ttfamily,
morekeywords={raise}]
}
%% generic inline code, argument is the language
\newcommand{\code}[1]{\lstinline[language=#1,basicstyle=\ttfamily]}
%% PL stuff
\newcommand{\bnf}{\ensuremath{\ \ | \ \ }}
\newcommand{\sep}{\bnf}
\newcommand\sqleq{\ensuremath\sqsubseteq}
% Language Constructs
\newcommand\impfnt[1]{\mbox{\bf #1}}
\newcommand{\IF}{\impfnt{if}}
\newcommand{\THEN}{\impfnt{then}}
\newcommand{\ELSE}{\impfnt{else}}
\newcommand{\SKIP}{\impfnt{skip}}
\newcommand{\WHILE}{\impfnt{while}}
\newcommand{\DO}{\impfnt{do}}
\newcommand{\BREAK}{\impfnt{break}}
\newcommand{\UNTIL}{\impfnt{until}}
\newcommand{\TRUE}{\impfnt{true}}
\newcommand{\FALSE}{\impfnt{false}}
\newcommand{\FOR}{\impfnt{for}}
\newcommand{\TO}{\impfnt{to}}
\newcommand{\cond}[3]{\ensuremath{\IF \: #1 \:\THEN\: #2 \:\ELSE\: #3}}
\newcommand{\while}[2]{\ensuremath{\WHILE \: #1 \:\DO\: #2}}
% Type Constructs
\newcommand\lam[2]{\lambda#1.\,#2}
\newcommand\Lam[2]{\Lambda#1.\,#2}
\DeclareMathOperator{\arrow}{\rightarrow}
\DeclareMathOperator{\ty}{\!:\!}
\DeclareMathOperator{\proves}{\vdash}
% Operational Semantics
\newcommand{\config}[2]{\ensuremath{\langle #1,\, #2 \rangle}}
\newcommand{\configB}[4]{\ensuremath{\langle #1,\, #2,\, #3,\, #4 \rangle}}
\newcommand{\stepsto}{\Downarrow}
\newcommand{\stepsone}{\longrightarrow}
\newcommand\sub[1]{_{\mbox{\scriptsize #1}}}
\newcommand\subst[3]{{\ensuremath #1\{#2/#3\}}}
\newcommand\definedas{\stackrel{\triangle}{=}}
\newcommand\translatesto{\;\;\longmapsto\;\;}
\newcommand\fn{\ensuremath\lambda}
\newcommand{\Rule}[2]{\infer{#2}{#1}}
\newcommand{\RuleSide}[3]{\infer[#3]{#2}{#1}}
% Denotational Semantics
\newcommand\join{\ensuremath\bigsqcup}
\newcommand\lift[1]{\ensuremath{\lfloor #1 \rfloor}}
%%
%% End of file 'bkc.sty'.