-
Notifications
You must be signed in to change notification settings - Fork 0
/
esop-common.sty
264 lines (237 loc) · 12.2 KB
/
esop-common.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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
\usepackage{textcomp}
\usepackage{mmm}
\usepackage{mathpartir}
\usepackage{esop-clj-grammar}
\usepackage{xcolor}
\usepackage{framed}
\usepackage{enumitem}
\usepackage{float}
\usepackage{chngcntr}
% computer modern lacks a bold, monospaced font. this adds one
% by using lmodern, a font that is designed to be a superset of computer modern.
\either{\usepackage{lmodern}}{} % bold font in listing https://tex.stackexchange.com/a/115444
\floatstyle{plain} % optionally change the style of the new float
\newfloat{Code}{H}{myc}
\usepackage{listings}
\lstdefinelanguage{Clojure}%
{morekeywords={*,*1,*2,*3,*agent*,*allow-unresolved-vars*,*assert*,*clojure-version*,*command-line-args*,%
*compile-files*,*compile-path*,*e,*err*,*file*,*flush-on-newline*,*in*,*macro-meta*,%
*math-context*,*ns*,*out*,*print-dup*,*print-length*,*print-level*,*print-meta*,*print-readably*,%
*read-eval*,*source-path*,*use-context-classloader*,*warn-on-reflection*,+,-,->,->>,..,/,:else,%
<,<=,=,==,>,>=,@,accessor,aclone,add-classpath,add-watch,agent,agent-errors,aget,alength,alias,%
all-ns,alter,alter-meta!,alter-var-root,amap,ancestors,and,apply,areduce,array-map,aset,%
aset-boolean,aset-byte,aset-char,aset-double,aset-float,aset-int,aset-long,aset-short,assert,%
assoc,assoc!,assoc-in,associative?,atom,await,await-for,await1,bases,bean,bigdec,bigint,binding,%
bit-and,bit-and-not,bit-clear,bit-flip,bit-not,bit-or,bit-set,bit-shift-left,bit-shift-right,%
bit-test,bit-xor,boolean,boolean-array,booleans,bound-fn,bound-fn*,butlast,byte,byte-array,%
bytes,case,cast,char,char-array,char-escape-string,char-name-string,char?,chars,chunk,chunk-append,%
chunk-buffer,chunk-cons,chunk-first,chunk-next,chunk-rest,chunked-seq?,class,class?,%
clear-agent-errors,clojure-version,coll?,comment,commute,comp,comparator,compare,compare-and-set!,%
compile,complement,concat,cond,condp,conj,conj!,cons,constantly,construct-proxy,contains?,count,%
counted?,create-ns,create-struct,cycle,dec,decimal?,declare,def,definline,defmacro,defmethod,%
defmulti,defn,defn-,defonce,defprotocol,defstruct,deftype,delay,delay?,deliver,deref,derive,%
descendants,destructure,disj,disj!,dissoc,dissoc!,distinct,distinct?,do,do-template,doall,doc,%
dorun,doseq,dosync,dotimes,doto,double,double-array,doubles,drop,drop-last,drop-while,empty,empty?,%
ensure,enumeration-seq,eval,even?,every?,false,false?,ffirst,file-seq,filter,finally,find,find-doc,%
find-ns,find-var,first,float,float-array,float?,floats,flush,fn,fn?,fnext,for,force,format,future,%
future-call,future-cancel,future-cancelled?,future-done?,future?,gen-class,gen-interface,gensym,%
get,get-in,get-method,get-proxy-class,get-thread-bindings,get-validator,hash,hash-map,hash-set,%
identical?,identity,if,if-let,if-not,ifn?,import,in-ns,inc,init-proxy,instance?,int-array,%
integer?,interleave,intern,interpose,into,into-array,ints,io!,isa?,iterate,iterator-seq,juxt,%
key,keys,keyword,keyword?,last,lazy-cat,lazy-seq,let,letfn,line-seq,list,list*,list?,load,load-file,%
load-reader,load-string,loaded-libs,locking,long,long-array,longs,loop,macroexpand,macroexpand-1,%
make-array,make-hierarchy,map,map?,mapcat,max,max-key,memfn,memoize,merge,merge-with,meta,%
method-sig,methods,min,min-key,mod,monitor-enter,monitor-exit,name,namespace,neg?,new,newline,%
next,nfirst,nil,nil?,nnext,not,not-any?,not-empty,not-every?,not=,ns,ns-aliases,ns-imports,%
ns-interns,ns-map,ns-name,ns-publics,ns-refers,ns-resolve,ns-unalias,ns-unmap,nth,nthnext,num,%
number?,odd?,or,parents,partial,partition,pcalls,peek,persistent!,pmap,pop,pop!,pop-thread-bindings,%
pos?,pr,pr-str,prefer-method,prefers,primitives-classnames,print,print-ctor,print-doc,print-dup,%
print-method,print-namespace-doc,print-simple,print-special-doc,print-str,printf,println,println-str,%
prn,prn-str,promise,proxy,proxy-call-with-super,proxy-mappings,proxy-name,proxy-super,%
push-thread-bindings,pvalues,quot,rand,rand-int,range,ratio?,rational?,rationalize,re-find,%
re-groups,re-matcher,re-matches,re-pattern,re-seq,read,read-line,read-string,recur,reduce,ref,%
ref-history-count,ref-max-history,ref-min-history,ref-set,refer,refer-clojure,reify,%
release-pending-sends,rem,remove,remove-method,remove-ns,remove-watch,repeat,repeatedly,%
replace,replicate,require,reset!,reset-meta!,resolve,rest,resultset-seq,reverse,reversible?,%
rseq,rsubseq,second,select-keys,send,send-off,seq,seq?,seque,sequence,sequential?,set,set!,%
set-validator!,set?,short,short-array,shorts,shutdown-agents,slurp,some,sort,sort-by,sorted-map,%
sorted-map-by,sorted-set,sorted-set-by,sorted?,special-form-anchor,special-symbol?,split-at,%
split-with,str,stream?,string?,struct,struct-map,subs,subseq,subvec,supers,swap!,symbol,symbol?,%
sync,syntax-symbol-anchor,take,take-last,take-nth,take-while,test,the-ns,throw,time,to-array,%
to-array-2d,trampoline,transient,tree-seq,true,true?,try,type,unchecked-add,unchecked-dec,%
unchecked-divide,unchecked-inc,unchecked-multiply,unchecked-negate,unchecked-remainder,%
unchecked-subtract,underive,unquote,unquote-splicing,update-in,update-proxy,use,val%
,vals,%
var,var-get,var-set,var?,vary-meta,vec,vector,vector?,when,when-first,when-let,when-not,%
while,with-bindings,with-bindings*,with-in-str,with-loading-context,with-local-vars,%
with-meta,with-open,with-out-str,with-precision,xml-seq,zero?,zipmap
% Typed Clojure
,defalias,ann,HMap,Nothing,Sym,Int,Boolean,U,Coll,Any,:mandatory,:optional,Vec,Str,AnyFunction,Atom1,Character,Map,All,IFn,%
% spec
,s/def,number?,boolean?,s/keys,:req,:req-un,:opt,:opt-un
% clojure.spec
,deftest
% weird macro forms
,~@
},%
sensitive,% ???
alsodigit=-,%
alsoletter=:/?,% don't highlight keywords, or namespaced keywords, consider predicates
morecomment=[l];,%
morestring=[b]",%
moredelim=**[is][\color{red}]{__red>}{<red__},%
}[keywords,comments,strings]%
\lstdefinelanguage{JavaScript}{
keywords={break, case, catch, class, continue, debugger, default, delete, do, else, finally, for, function, if, in, instanceof, new, public, return, switch, this, throw, try, typeof, var, void, while, with},
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]',
morestring=[b]",
sensitive=true,
basicstyle=\ttfamily\color{black},
moredelim=**[is][\color{red}]{@}{@},
literate={},
stringstyle=\color{stringgray}\textit % string literal style
}
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{stringgray}{rgb}{0.4,0.4,0.4}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\definecolor{types}{rgb}{0.16, 0.32, 0.75}
%\definecolor{types}{rgb}{0.0, 0.75, 1.0}
\definecolor{turnstile}{rgb}{0.0, 0.5, 1.0}
%\definecolor{interop}{rgb}{0,0.8,0}
%\definecolor{interop}{rgb}{0.89, 0.44, 0.48}
\definecolor{interop}{rgb}{0.01, 0.75, 0.24}
\definecolor{invoke}{rgb}{0,0,0}
\lstset{ %
upquote=true,
language=Clojure, % choose the language of the code
columns=fixed,
basewidth=.5em,
basicstyle=\ttfamily, % the size of the fonts that are used for the code
%numbers=left, % where to put the line-numbers
%numberstyle=\small\ttfamily, % the size of the fonts that are used for the line-numbers
%stepnumber=1, % the step between two line-numbers. If it is 1 each line will be numbered
%numbersep=5pt, % how far the line-numbers are from the code
%backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
%showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
%showtabs=false, % show tabs within strings adding particular underscores
%frame=single, % adds a frame around the code
%tabsize=2, % sets default tabsize to 2 spaces
%captionpos=t, % sets the caption-position to bottom
%breaklines=true, % sets automatic line breaking
%breakatwhitespace=true, % sets if automatic breaks should only happen at whitespace
%escapeinside={\%*}{*)}, % if you want to add a comment within your code
literate=
%{\#\{*set\ }{{\textcolor{red}{\#\{}}}1
%{\ set*\}} {{\textcolor{red}{\}}}}1
{\{}{{\textcolor{mygray}{\{}}}1
{\}} {{\textcolor{mygray}{\}}}}1
{\{*map\ }{{\textcolor{red}{\{}}}1
{\ map*\}} {{\textcolor{red}{\}}}}1
{[} {{\textcolor{mygray}{[}}}1
{]} {{\textcolor{mygray}{]}}}1
{(} {{\textcolor{mygray}{(}}}1
{\#} {{\textcolor{mygray}{\#}}}1
{)} {{\textcolor{mygray}{)}}}1
{:-} {{\textcolor{types}{:-}}}1
{->} {{\textcolor{mygray}{->}}}1
{[*vec\ } {{\textcolor{red}{[}}}1
{\ vec*]} {{\textcolor{red}{]}}}1
{(*list\ } {{\textcolor{red}{(}}}1
{\ list*)} {{\textcolor{red}{)}}}1
{(*interop\ } {{\textcolor{interop}{(}}}1
{\ interop*)} {{\textcolor{interop}{)}}}1
{(*typed\ } {{\textcolor{types}{(}}}1
{\ typed*)} {{\textcolor{types}{)}}}1
{(*invoke\ } {{\textcolor{invoke}{(}}}1
{\ invoke*)} {{\textcolor{invoke}{)}}}1
}
\lstset{ %
%backgroundcolor=\color{white}, % choose the background color
%basicstyle=\footnotesize, % size of fonts used for the code
commentstyle=\color{mygray}, % comment style
escapeinside={(*@}{@*)},
mathescape=true,
%moredelim=**[is][\color{red}]{@}{@},
moredelim=**[is][\color{red}]{__red>}{<red__},
%escapeinside={\%*}{*)}, % if you want to add LaTeX within your code
keywordstyle=\bfseries, % keyword style
stringstyle=\color{stringgray}\textit, % string literal style
}
\lstnewenvironment{cljlisting}
{\either{\singlespacing}{}
\lstset{language=Clojure,
}
}
{}
% this is specifically for big CLJS example in the pldi submission
\lstnewenvironment{cljlistingnumbered}
{\either{\singlespacing}{}
\lstset{language=Clojure,
numbers=left,
numbersep=-8pt
}}
{}
\usepackage{amsmath}
\DeclareMathSymbol{\Gamma}{\mathalpha}{operators}{0}
\newcommand\smallsection[1]{\textbf{\emph{#1}}}
\usepackage{amsthm}
\usepackage{suffix}
\newcommand\Dchapter[1]{\either{\chapter{#1}}{\section{#1}}}
\newcommand\Dchapref[1]{\either{\chapref{#1}}{\secref{#1}}}
\newcommand\Dsection[1]{\either{\section{#1}}{\subsection{#1}}}
\WithSuffix\newcommand\Dsection*[1]{\either{\section*{#1}}{\subsection*{#1}}}
\newcommand\Dsubsection[1]{\either{\subsection{#1}}{\subsubsection{#1}}}
\ifdefined\DISSERTATION
\newcommand{\@dotsep}{12}
\usepackage{thmtools}
% commented out to use thmtools instead
%\newtheorem{assumption}{Assumption}
%\newtheorem{lemma}{Lemma}
%\newtheorem{theorem}{Theorem}
%\newtheorem{corollary}{Corollary}
%\newtheorem{definition}{Definition}
\declaretheorem[numberwithin=chapter]{assumption}
\declaretheorem[numberwithin=chapter]{lemma}
\declaretheorem[numberwithin=chapter]{theorem}
\declaretheorem[numberwithin=chapter]{corollary}
\declaretheorem[numberwithin=chapter]{definition}
\declaretheorem[numberwithin=chapter]{conjecture}
%\declaretheorem[numberwithin=chapter, name=Assumption]{assumption}
%\declaretheorem[numberwithin=chapter, name={Lemma}]{lemma}
%\declaretheorem[numberwithin=chapter, name={Theorem}]{theorem}
%\declaretheorem[numberwithin=chapter, name={Corollary}]{corollary}
%\declaretheorem[numberwithin=chapter, name={Definition}]{definition}
\fi
\theoremstyle{remark}
\newtheorem*{case}{Case}
\theoremstyle{remark}
\newtheorem*{subcase}{Subcase}
%http://tex.stackexchange.com/questions/150492/how-to-use-itemize-in-table-environment
\usepackage{booktabs}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\newcommand{\clj}[1]{\text{\lstinline[language=Clojure]{#1}}}
\newcommand{\js}[1]{\lstinline[language=JavaScript]{#1}}
\newcommand{\java}[1]{\lstinline[language=Java]{#1}}
\newcommand{\rkt}[1]{\lstinline[language=Lisp]{#1}}
\newcommand{\sml}[1]{\lstinline[language=ML]{#1}}
\usepackage{url}
\newcounter{ex}
\newenvironment{exmp}{
\refstepcounter{ex}%
\par\vspace{.0em}\hfill\framebox{\small Example~\theex}\nopagebreak
\\[-4.00em]\nopagebreak}
{\relax}
\newenvironment{exmp2}{
\refstepcounter{ex}%
\par\vspace{3em}\hfill\framebox{\small Example~\theex}\nopagebreak
\\[-3.23em]\nopagebreak}
{\relax}
\newenvironment{mintedclj}{
\begin{verbatim}%
}
{\end{verbatim}%
}%