-
-
Notifications
You must be signed in to change notification settings - Fork 91
/
main-moonmath.tex
323 lines (263 loc) · 12.1 KB
/
main-moonmath.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
321
322
323
% 1.) The document uses graphviz which generates .ps files and
% auto-pst-pdf to convert to pdf.
% => Build command needs an update:
% --enable-write18
% Example:
% pdflatex -synctex=1 -interaction=nonstopmode --enable-write18 FILE.tex
%If using an editor to build the document, enable shell escape:
% --shell-escape
% Example (under "Engines" in TexShop Preferences):
%pdflatex --file-line-error --synctex=1 --enable-write18 --shell-escape
%2.) Execute Sage:
% a.) build latex
% b.) sage moonmath.sagetex.sage
% c.) build latex again MANY TIMES! :-) (3x according to Mirco)
%
\documentclass[a4paper,oneside,12pt]{book}
%margins
\usepackage[a4paper, margin=2.5cm]{geometry}
\setcounter{secnumdepth}{4}
%headers and footers
\usepackage{fancyhdr}%version 4.0.1 or above should be used
\pagestyle{fancy}
\setlength{\headheight}{15pt}
\fancyhead[L]{\leftmark}%current chapter
\fancyhead[R]{\rightmark}%current section
\fancyfoot{}%cancel default footer
\fancyfoot[C]{\thepage}%footer center
% Use listings for all algorithms?
\usepackage{listings}
%fonts
% times is the font I (Mirco) thinks looks the most calm, ordered and math-textbook like
\usepackage{times}
% use times style for mathmode, too
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
% integer long division
\usepackage{longdivision}
% polynomial long division
\usepackage{polynom}
\usepackage{amssymb,amsmath,amsthm,mathrsfs,xspace}
\usepackage{polydiv}
\usepackage{amscd}
\usepackage[all]{xy}
\usepackage{comment}
\usepackage{algorithm}
\usepackage{algpseudocode}
% We use algorithmicX, since we need to customize commands (\algblockdefx)
% See https://ftp.agdsn.de/pub/mirrors/latex/dante/macros/latex/contrib/algorithmicx/algorithmicx.pdf for howTo customize
\usepackage{algorithmicx}
% writing complex graphs by hand is tedious and often not visually optimal
% let graphviz handle this
% graphs are written in the 'dot'-language
\usepackage[singlefile, pdf,tmpdir]{graphviz}
%\usepackage{auto-pst-pdf}
\usepackage{enumitem} % for personalizing enumeration with itemize
% the sagetex evironment
\usepackage{sagetex}
% long numbers need proper line break in sage environment
% from https://ask.sagemath.org/question/53064/sagetex-linebreak/
\usepackage{seqsplit}
\lstset{
literate=
{1}{1\allowbreak}1
{2}{2\allowbreak}1
{3}{3\allowbreak}1
{4}{4\allowbreak}1
{5}{5\allowbreak}1
{6}{6\allowbreak}1
{7}{7\allowbreak}1
{8}{8\allowbreak}1
{9}{9\allowbreak}1
{0}{0\allowbreak}1,
breaklines=true}
% sagecommandline color sheme
\usepackage{xcolor}
% color of the sagecommandline-tex-environment
\lstset{language=Sage,
commentstyle={\ttfamily\color{black}},
keywordstyle={\ttfamily\color{black}\bfseries},
stringstyle ={\ttfamily\color{black}\bfseries},
tabsize = 4,
basicstyle={\small \ttfamily},
backgroundcolor= \color{white},
}
%add line numbers to the PDF
%\usepackage{lineno}
%\linenumbers
\usepackage{tabularx}
%Load the following packages last
\usepackage{hyperref} % for all kinds of links
\usepackage{cleveref}%must be loaded after `hyperref`
% styling hyperlinks
\input{colors}
\urlstyle{same}%use the same font (shape) for links as for the rest of the text (rather than the default typewriter font)
% This sets the colo
\hypersetup{
colorlinks=true, %color links by default
linkcolor=darkgray, %the color of document-internal links
filecolor=darkgray, %the color of links to local files (probably won't be used, but added for completeness' sake)
urlcolor=darkgray, %the color of links to web sites
citecolor=darkgray, %the color of links to the reference list
}
%bibliography management
\usepackage{natbib}
\bibliographystyle{unsrtnat}%we can discuss what style we want to use
%math typesetting
\usepackage{amsfonts}
% standard \mathcal
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
% Table of Contents
\setcounter{tocdepth}{4}
%lists with reduced vertical spacing between items
\newcommand{\compactlist}{\setlength\itemsep{0em}}
% Macros
% Fields and categories
\newcommand{\C}{\mathbb{C}}
\newcommand{\G}{\mathbb{G}}
\newcommand{\Prim}{\mathbb{P}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\NN}{\mathbb{N}_0}
\newcommand{\K}{\mathbb{K}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\X}{\mathfrak{X}}
\newcommand{\Oinf}{\mathcal{O}}
\newcommand{\Tau}{\mathrm{ST}}
\newcommand{\Zdiv}[2]{#1 \text{ div } #2}
\newcommand{\Zmod}[2]{#1 \text{ mod } #2}
\newcommand{\kongru}[3]{#1 \equiv #2 {\hskip1ex plus 0.2ex minus 0.2ex\relax} \text{( mod } #3 \text{ )}}
\newcommand{\checkeq}{\mathrel{\substack{?\\[-.07em]=}}}
\newcommand{\legsym}[2]{\left(\frac{#1}{#2}\right)}
% inline code
\newcommand{\icode}[1]{\lstinline{#1}}
% theorem styles
\theoremstyle{remark}
\newtheorem{theorem}{Theorem}[subsection]
%\newtheorem{prop}[theorem]{Proposition}
%\newtheorem{lemma}[theorem]{Lemma}
%\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newcommand{\deftitle}[1]{\textbf{#1}}%used in the optional title of definitions
\newcommand{\defname}{definition}%word used for cross-referencing definitions in the text
\newcommand{\defvsep}{\hspace{0ex}\newline{}\vspace{-4ex}}% vertical space after definitions that start with a list
\newtheorem{conjecture}{Conjecture}
\newtheorem{remark}{Remark}
\newtheorem{notation}{Notation and Symbols}
% Examples get their own counter
\newcounter{ExampleCounter}
\newtheorem{example}[ExampleCounter]{Example}
% Exercises get their own counter
\newcounter{ExerciseCounter}
\newtheorem{exercise}[ExerciseCounter]{Exercise}
% Jargon get their own counter
\newcounter{JargonCounter}
\newtheorem{jargon}[JargonCounter]{Jargon}
% algorithmicx commands
%\algnewcommand\algorithmicinput{\textbf{Statement:}}
%\algnewcommand\Statement{\item[\algorithmicinput]}
%colors
\definecolor{la-purple}{HTML}{312265}%primary purple
\definecolor{la-purple-med}{HTML}{594982}%primary purple at 80%
\definecolor{la-purple-light}{HTML}{D3CDDE}%primary purple at 20%
\usepackage{mfirstuc}
%text highlighting
\newcommand{\term}[1]{\textbf{#1}}%technical terms that are being defined
\newcommand{\uterm}[1]{\textcolor{red}{#1}\todo[color=red]{#1}}%new terms introduced in the text that have not been defined or are not being defined. Note: these are only highlighted when they are used in non-meta text, e.g. not in the text outlining the structure of the chapter ahead. The argument of the command is repeated on purpose to appear in both the inline text and the margin note/list of to do items
\newcommand{\utermlong}[1]{\textcolor{red}{#1}}%longer inline markings for undefined terms
\usepackage[textwidth=2cm,textsize=small,colorinlistoftodos]{todonotes}
%\usepackage[disable]{todonotes}
\newcommand{\final}[1]{\fboxsep=0pt\todo[color=yellow]{#1}}%things that need to be checked only at the very final typesetting stage
\newcommand{\finallong}[1]{\colorbox{yellow}{#1}}%longer inline marking for things that need to be checked only at the very final typesetting stage
\newcommand{\finalcomb}[2]{\colorbox{yellow}{#1}\fboxsep=0pt\todo[color=yellow]{#2}}%things that need to be checked only at the very final typesetting stage – highlight text and add different comment in margin
\newcommand{\tbds}[1]{\textcolor{orange}{#1}\todo{#1}}%notes to self/TBD for Sylvia - the argument of the command is repeated on purpose to appear in both the inline text and the margin note/list of to do items
\newcommand{\tbdsm}[1]{\todo{#1}}%notes to self/TBD for Sylvia - only appear in the margins
\newcommand{\tbdslong}[1]{\textcolor{orange}{#1}}%longer inline notes to self/TBD for Sylvia
\newcommand{\tbdscomb}[2]{\textcolor{orange}{#1}\todo{#2}}%longer inline notes to self/TBD for Sylvia – highlight text and add different comment in margin
\newcommand{\sme}[1]{\todo[color=green]{#1}}%comments/questions for subject matter experts
\newcommand{\smelong}[1]{\textcolor{green}{#1}}%longer inline comments/questions for subject matter experts
\newcommand{\smecomb}[2]{\textcolor{green}{#1}\todo[color=green]{#2}}%longer inline comments/questions for subject matter experts – highlight text and add different comment in margin
\newcommand{\comms}[1]{\textcolor{la-purple-med}{#1}\todo[color=la-purple-med,textcolor=white]{#1}}%notes/highlights for the marketing/communications team
\newcommand{\commslong}[1]{\textcolor{la-purple-med}{#1}}%longer inline notes for comms
\newcommand{\commscomb}[2]{\textcolor{la-purple-med}{#1}\todo[color=la-purple-med,textcolor=white]{#2}}%notes/highlights for the marketing/communications team – highlight text and add different comment in margin
%remove markings from PDF. Comment out if you want the annotations visible
\renewcommand{\tbds}[1]{#1}
\renewcommand{\tbdsm}[1]{}
\renewcommand{\tbdslong}[1]{}
\renewcommand{\tbdscomb}[2]{#1}
\renewcommand{\sme}[1]{}
\renewcommand{\smelong}[1]{}
\renewcommand{\smecomb}[2]{}
\renewcommand{\comms}[1]{#1}
\renewcommand{\commslong}[1]{}
\renewcommand{\commscomb}[2]{#1}
\renewcommand{\uterm}[1]{#1}
\newcommand{\hilight}[1]{\textbf{#1}}%basically, our own version of \emph. we can decide later if it'll be italic, boldface or a highlight color
\newcommand{\code}[1]{\texttt{#1}}%parts of code, names of files or libraries
\newcommand{\curvename}[1]{\textsf{\small #1}}%names of elliptic curves
\newcommand{\examplename}{example}%word used for cross-referencing examples in the text
\newcommand{\secname}{section}%word used for cross-referencing (sub)*sections in the text
\newcommand{\chaptname}{chapter}%word used for cross-referencing chapters in the text
\newcommand{\algname}{algorithm}%word used for cross-referencing algorithms in the text
\newcommand{\exercisename}{exercise}%word used for cross-referencing excercises in the text
\newcommand{\notationname}{notation}%word used for cross-referencing notations in the text
\newcommand{\concept}[1]{\capitalisewords{#1}}%fixed terms for mathematical concepts, methods, etc.
\newcommand{\TJJ}{\curvename{${TJJ\_13}$}}%the name of the TJJ13 curve
\newcommand{\lgname}[1]{\texttt{#1}}%names of formal languages
\newcommand{\fname}[1]{\texttt{#1}}%filedescriptor
\newcommand{\sname}[1]{\texttt{#1}}%s-descriptor
\newcommand{\bool}[1]{\textsc{#1}}%Boolean values
%only typesets the chapters specified here, but keeps the TOC, page and section numbering, etc. comment the following line out if you want the whole book to be typeset; modify file names accordingly if you want to typeset other chapters
%\includeonly{chapters/ops-notes-moonmath,%
%chapters/preface-moonmath,%
%chapters/intro-moonmath,%
%chapters/preliminaries-moonmath,%
%chapters/arithmetics-moonmath,%
%chapters/algebra-moonmath,%
%chapters/elliptic-curves-moonmath,%
%chapters/statements-moonmath,%
%chapters/circuit-compilers-moonmath,%
%chapters/zk-protocols-moonmath,%
%}
%the following command is a placeholder for the text that describes which chapters are typeset. it should be used in Operational notes. Define it as empty when the whole document is typeset.
%\newcommand{\inclonlytext}[1]{{
%\Large NB: This PDF only includes the following chapters: Introduction, Preliminaries, Algebra.
%}
\usepackage{makeidx}
\makeindex
\renewcommand{\term}[1]{\textbf{#1}\index{#1}}
%whole page graphics for titlepage
\usepackage{pdfpages}
\begin{document}
% set the language for the listings package
\lstset{language=python }
\frontmatter
%title page using the packege `pdfpages`
\includepdf{figures/MMM_cover.jpg}
%\include{chapters/ops-notes-moonmath}
\include{chapters/license-header-moonmath}
% its common to put the preface before the table of content
\include{chapters/preface-moonmath}
\tableofcontents
\mainmatter
\include{chapters/intro-moonmath}
\include{chapters/software-used-moonmath}
\include{chapters/arithmetics-moonmath}
\include{chapters/algebra-moonmath}
\include{chapters/elliptic-curves-moonmath}
\include{chapters/statements-moonmath}
\include{chapters/circuit-compilers-moonmath}
\include{chapters/zk-protocols-moonmath}
%\include{chapters/exercise-solutions-moonmath}
\backmatter
\cleardoublepage\phantomsection
\addcontentsline{toc}{chapter}{Index}
\printindex
\cleardoublepage\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{moonmath}%use `moonmath.bib` to look for references, and print bibliography at this point in the document
\include{chapters/license-moonmath}
\end{document}