forked from realworldocaml/book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcup-template.tex
320 lines (297 loc) · 9 KB
/
cup-template.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
% EngDguide.tex
% for the suite of standard Cambridge designs
% 2021/07/01, v1.30
\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\documentclass[multi,print,final]{EngD}
\reinstaterules
% \documentclass[multi]{EngD} % multi-contributor option
% \documentclass[prodtf]{EngD}% if you have helvetica neue condensed fonts
\usepackage[rightcaption,raggedright]{sidecap}% for side captions
\usepackage{framed} % for floatingboxes
\usepackage{soul} % for letterspacing in theorem-style headings
% for the Harvard author-date referencing system %%throw this away
% \usepackage[agsm]{harvard}
\usepackage{natbib}
\usepackage{crop}
% if you are using either vancouver.bst or IEEEtran.bst and wish to remove
% square braces in the reference list, uncomment the line below
% \removesquarebraces
\usepackage[chapter]{algorithm}
\usepackage{algorithmic}
\usepackage[figuresright]{rotating}
\usepackage{floatpag}
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage[hidelinks]{hyperref}}
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\DeclareRobustCommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
\def\sectionautorefname{Chapter}
\def\chapterautorefname{Chapter}
\def\subsectionautorefname{Chapter}
\rotfloatpagestyle{empty}
\usepackage[bottom]{footmisc}
\usepackage{amsmath}% if you are using this package,
% it must be loaded before amsthm.sty
\usepackage{amsthm}
\usepackage{newtxtext}
\usepackage{newtxmath}
\usepackage{graphicx}
\makeatletter
\renewcommand*{\pagenumbering}[1]{%
\gdef\thepage{\csname @#1\endcsname\c@page}%
}
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\usepackage{float}
\floatplacement{figure}{H}
\usepackage{csquotes}
\usepackage{colour-blind}
\usepackage[most]{tcolorbox}
%textmarker style from colorbox doc
\tcbuselibrary{breakable}
\tcbset{textmarker/.style={%
enhanced,breakable,
parbox=false,boxrule=0mm,boxsep=0mm,arc=0mm,
outer arc=0mm,left=6mm,right=3mm,top=7pt,bottom=7pt,
toptitle=1mm,bottomtitle=1mm,oversize}}
% define new colorboxes
\newtcolorbox{hintBox}{textmarker,
borderline west={6pt}{0pt}{cb-yellow},
colback=cb-yellow!10!white}
\newtcolorbox{warningBox}{textmarker,
borderline west={6pt}{0pt}{cb-salmon-pink},
colback=cb-salmon-pink!10!white}
\newtcolorbox{noteBox}{textmarker,
borderline west={6pt}{0pt}{cb-blue-light},
colback=cb-blue-light!10!white}
$if(listings)$
\usepackage{listings,lstautogobble}
\newcommand{\passthrough}[1]{#1}
\lstset{defaultdialect=[5.3]Lua}
\lstset{defaultdialect=[x86masm]Assembler}
\lstset{
autogobble,
columns=fullflexible,
showspaces=false,
keepspaces=true,
showtabs=false,
breaklines=true,
showstringspaces=false,
breakatwhitespace=true,
commentstyle=\color{cb-black},
keywordstyle=\color{cb-black},
stringstyle=\color{cb-black},
numberstyle=\color{cb-black},
basicstyle=\ttfamily\small,
frame=l,
rulecolor=\color{gray},
framesep=10pt,
xleftmargin=10pt,
tabsize=4,
captionpos=b,
literate=
{á}{{\'a}}1
{é}{{\'e}}1
{ô}{{\^o}}1
{┌}{\textSFi}1%
{┐}{\textSFiii}1%
{└}{\textSFii}1%
{┘}{\textSFiv}1%
{┬}{\textSFvi}1%
{┴}{\textSFvii}1%
{├}{\textSFviii}{1}%
{┤}{\textSFix}{1}%
{─}{\textSFx}1%
{—}{\textSFx}1%
{│}{\textSFxi}1%
{┼}{\textSFv}1%
}
\lstdefinelanguage[Objective]{Caml}[light]{Caml}
{deletekeywords={not,prefix,value,where},%
morekeywords={assert,asr,class,closed,constraint,external,false,%
functor,include,inherit,land,lazy,lor,lsl,lsr,lxor,method,mod,%
module,new,open,parser,private,sig,struct,true,val,virtual,when,%
object,ref},% TH
}%
\lstdefinelanguage[light]{Caml}
{morekeywords={and,as,begin,do,done,downto,else,end,exception,for,%
fun,function,if,in,let,match,mutable,not,of,or,prefix,rec,then,%
to,try,type,value,where,while,with},%
sensitive,%
morecomment=[n]{(*}{*)},%
morestring=[b]",%
moredelim=[is][\itshape\color{dgray}]{((:}{::)},
moredirectives={open,close,include}%
}[keywords,comments,strings,directives]%
\definecolor{bluekeywords}{rgb}{0.0, 0.0, 0.5 }
\definecolor{greencomments}{rgb}{0, 0.5, 0}
\definecolor{redstrings}{rgb}{0.5, 0.0, 0.0}
\definecolor{dgray}{rgb}{0.30, 0.30, 0.30}
\hypersetup{
colorlinks = true, %Colours links instead of ugly boxes
urlcolor = cb-black, %Colour for external hyperlinks
linkcolor = cb-black, %Colour of internal links
citecolor = cb-black %Colour of citations
}
$endif$
\usepackage{longtable,booktabs,graphicx,fancyvrb,iftex,upquote,microtype,setspace}
% indexes
% uncomment the relevant set of commands
% for a single index
\usepackage{makeidx}
\makeindex
% times font (used to produce EngDguide.pdf)
% this package must be loaded after amsthm.sty
% for multiple indexes using multind.sty
%\usepackage{multind}
%\ProvidesPackage{multind}
%\makeindex{authors}
%\makeindex{subject}
% for multiple indexes using index.sty
% \usepackage{index}
% \newindex{aut}{adx}{and}{Author index}
% \makeindex
%\usepackage{glossaries}
%\makeglossaries
%\input glossaries.tex
\newcommand\cambridge{EngD}
% see chapter 3 for details
\theoremstyle{plain}% default
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem*{corollary*}{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{condition}[theorem]{Condition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem{remark}{Remark}[chapter]
\newtheorem{notation}[remark]{Notation}
\newtheorem*{case}{Case}
\hyphenation{line-break line-breaks docu-ment triangle cambridge amsthdoc
cambridgemods baseline-skip author authors cambridgestyle en-vir-on-ment polar}
\setcounter{tocdepth}{2}% the toc normally lists sections;
% for the purposes of this document, this has been extended to subsections
\makeatletter
\def\TeX{TeX}
\renewcommand{\LaTeX}{La\TeX}
\renewcommand{\LaTeXe}{La\TeX2e}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \includeonly{chap2}
\makeatletter
\let\@endpart\vfil
\makeatother
\raggedbottom
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\arabicfootnotes
\frontmatter
\begin{halftitlepage}
$if(title)$
\halftitle{$title$}
$endif$
$if(subtitle)$
\halfsubtitle{$subtitle$}
$endif$
%\vskip\baselineskip
\halftitleblurb{Functional Programming for the Masses.}
%\vskip\baselineskip
\halftitleauthor{Anil Madhavapeddy and Yaron Minsky}.
\end{halftitlepage}
\cleardoublepage
\begin{titlepage}
\fmtitle{$title$}
\fmsubtitle{$subtitle$}
\fmtitleauthor{Anil Madhavapeddy}
\fmtitleaffil{University of Cambridge}
\fmtitleauthor{Yaron Minsky}
\fmtitleaffil{Jane Street}
%\cuplogo
\end{titlepage}
\begin{copyrightpage}
%\copyrightlogo\par\vskip\baselineskip
\end{copyrightpage}
\begin{dedication}
For Lisa, a believer in the power of words,\\
who helps me find mine.~~~--Yaron
\\
\vspace{1cm}
For Mum and Dad, who took me to the library\\
and unlocked my imagination.~~~--Anil
\end{dedication}
\tocmax{2.10}{2.8.8}{}
\setcounter{page}{6}
\makeatletter
\addtocontents{toc}{\hspace*{-18mm}}
\makeatother
\tocmax{99.99}{99.99.9}{}
\tableofcontents
%\listoffigures
%\listoftables
%\listoffloatingboxes
% \listofcontributors
%\chapter*{List of Contributors}
%\begin{contriblist}
% \contributor{Magn\’us M\’ar Magn\’usson
%
%
%
%
%\contributor{David Tranah
%\affiliation{International Glaciological Society,
%Scott Polar Research Institute,
%Lensfield Road, Cambridge CB2 1ER}}
%
%
%
%\end{contriblist}
%\affiliation{Cambridge University Press,
% The Edinburgh Building, Shaftesbury Road,
% Cambridge CB2 8RU}}
\cleardoublepage
\ \thispagestyle{empty}
\cleardoublepage
%\include{EngD_preface}
\pagenumbering{arabic}
\setcounter{page}{1}
\mainmatter
$body$
\backmatter
% if you only have one appendix, use \oneappendix instead of \appendix
\oneappendix
\endappendix
% insert a blank line to the toc list
\addtocontents{toc}{\vspace{\baselineskip}}
% bibliography style files
% \bibliographystyle{vancouver}% uncomment for vancouver style
% \bibliographystyle{IEEEtran} % uncomment for IEEE style
% \bibliographystyle{cambridgeauthordate} %% already called in chapter 5
% \renewcommand{\refname}{Bibliography}% if you prefer this heading
%\bookreferences
%\bibliography{percolation}\label{reflist}
\cleardoublepage
% indexes
% for a single index
\printindex
% for multiple indexes using multind.sty
%\printindex{authors}{Author index}
%\printindex{subject}{Subject index}
%\printglossaries
% for multiple indexes using index.sty
% \printindex[aut]
% \printindex
\end{document}
\endinput