arnaucube
arnaucube/davinci-paperPublic Self-hosted repository
davinci-paper/v2/build/preamble-macros.tex
v2/build/preamble-macros.texRaw
  1% !TeX root = main.tex
  2
  3% Doc sytle
  4\setcounter{secnumdepth}{3} %enumerate sections up to depth 3 (subsubsection)
  5% Set the first-level itemize label to use math mode \bullet
  6\setlist[itemize,1]{label=$\bullet$}
  7
  8% Working directory
  9\newcommand{\definedir}[2]{\newcommand{#1}{#2}}
 10\definedir{\secs}{../sections}
 11\definedir{\figs}{../figures}
 12\definedir{\bib}{../bibliography}
 13
 14% Comments
 15\newcommand{\marta}[1]{\todo[size=\small, color=red!40]{\textbf{Marta}: #1}}
 16\newcommand{\martai}[1]{\todo[inline, size=\small, color=red!40]{\textbf{Marta}: #1}}
 17\newcommand{\pau}[1]{\todo[size=\small, color=blue!40]{\textbf{Pau}: #1}}
 18\newcommand{\paui}[1]{\todo[inline, size=\small, color=blue!40]{\textbf{Pau}: #1}}
 19\newcommand{\jordi}[1]{\todo[size=\small, color=green!40]{\textbf{Jordi}: #1}}
 20\newcommand{\jordii}[1]{\todo[inline, size=\small, color=green!40]{\textbf{Jordi}: #1}}
 21
 22% Freefootnote
 23\let\svthefootnote\thefootnote
 24\newcommand\freefootnote[1]{%
 25	\let\thefootnote\relax%
 26	\footnotetext{#1}%
 27	\let\thefootnote\svthefootnote%
 28}
 29
 30% Table of contents style
 31% Make section entries bold in ToC
 32\makeatletter
 33\renewcommand{\@dotsep}{4.5}
 34\renewcommand{\l@section}[2]{\addpenalty{\@secpenalty}
 35	\addvspace{1.0em plus 1pt}
 36	\@tempdima=1.5em
 37	\parindent \z@ \rightskip \@pnumwidth
 38	\parfillskip -\@pnumwidth
 39	{\leavevmode
 40		\advance\leftskip\@tempdima
 41		\hskip -\leftskip
 42		\bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par}
 43\makeatother
 44
 45% Colours
 46\definecolor{cred}{rgb}{1, 0.5, 0.5}
 47\definecolor{cgreen}{rgb}{0.5, 1, 0.5}
 48\definecolor{cblue}{rgb}{0.5, 0.5, 1}
 49
 50% Hyperref setup
 51%\hypersetup{
 52%	final=true,
 53%	colorlinks=true,
 54%	linkcolor=cblue,
 55%	urlcolor=black,
 56%	citecolor=cblue,
 57%}
 58
 59% Mathbb
 60\newcommand{\N}{\ensuremath{\mathbb{N}}\xspace}
 61\newcommand{\Z}{\ensuremath{\mathbb{Z}}\xspace}
 62\newcommand{\G}{\ensuremath{\mathbb{G}}\xspace}
 63\newcommand{\F}{\ensuremath{\mathbb{F}}\xspace}
 64\newcommand{\J}{\ensuremath{\mathbb{J}}\xspace}
 65
 66% Elliptic curves
 67\newcommand{\BW}[1]{\ensuremath{{#1}^{\text{\tiny \sf BW}}}\xspace}
 68\newcommand{\BLS}[1]{\ensuremath{{#1}^{\text{\tiny \sf BLS}}}\xspace}
 69\newcommand{\BN}[1]{\ensuremath{{#1}^{\text{\tiny \sf BN}}}\xspace}
 70\newcommand{\BJ}[1]{\ensuremath{{#1}^{\text{\tiny \sf BJ}}}\xspace}
 71\newcommand{\SEC}[1]{\ensuremath{{#1}^{\text{\tiny \sf SEC}}}\xspace}
 72
 73% Circuits
 74\newcommand{\public}{{\sf\color{teal}public}\xspace}
 75\newcommand{\private}{{\sf\color{red}private}\xspace}
 76
 77% Ballot protocol
 78\newcommand{\ballotstyle}[1]{\texttt{#1}\xspace}
 79\newcommand{\maxcount}{\ballotstyle{maxCount}}
 80\newcommand{\maxvalue}{\ballotstyle{maxValue}}
 81\newcommand{\minvalue}{\ballotstyle{minValue}}
 82\newcommand{\uniquevalues}{\ballotstyle{uniqueValues}}
 83\newcommand{\maxtotalcost}{\ballotstyle{maxTotalCost}}
 84\newcommand{\mintotalcost}{\ballotstyle{minTotalCost}}
 85\newcommand{\costexponent}{\ballotstyle{costExponent}}
 86
 87% Voting protocol
 88\newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
 89\newcommand{\voteproof}{\variablestyle{voteProof}}
 90\newcommand{\ballot}{\variablestyle{ballot}}
 91\newcommand{\vote}{\variablestyle{vote}}
 92\newcommand{\processid}{\variablestyle{processID}}
 93\newcommand{\censuspf}{\variablestyle{censusProof}}
 94\newcommand{\commitment}{\variablestyle{identityCommitment}}
 95\newcommand{\nullifier}{\variablestyle{nullifier}}
 96\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
 97\newcommand{\zkproof}{\variablestyle{ZKproof}}
 98\newcommand{\signature}{\variablestyle{signature}}
 99\newcommand{\address}{\variablestyle{address}}
100
101% State Merkle tree
102\newcommand{\censusroot}{\variablestyle{censusRoot}}
103\newcommand{\type}{\variablestyle{type}}
104\newcommand{\ballotmode}{\variablestyle{ballotMode}}
105\newcommand{\epk}{\variablestyle{encryptionKey}}
106\newcommand{\addaccumulator}{\variablestyle{addedResultsAccumulator}}
107\newcommand{\substractaccumulator}{\variablestyle{substractResultsAccumulator}}
108\newcommand{\addresses}{\variablestyle{addresses}}
109\newcommand{\nullifiers}{\variablestyle{nullifiers}}
110\newcommand{\weight}{\variablestyle{weight}}
111
112% Others
113\newcommand{\noi}{\noindent}
114\newcommand{\conc}{\:||\:}
115
116% Hyperlinks
117\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
118\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
119
120% Cryptographic primitives
121\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
122\newcommand{\Hash}{\methodstyle{Hash}}
123\newcommand{\Enc}{\methodstyle{Enc}}
124\newcommand{\Dec}{\methodstyle{Dec}}
125\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
126\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
127\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
128\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
129
130\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
131\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
132\newcommand{\sk}[1][]{{\sf{sk}^{#1}}} 
133\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
134\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
135\newcommand{\sample}{\xleftarrow{\$}}
136
137% VOC token
138\newcommand{\token}{VOC\xspace}
139\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
140\newcommand{\baseCost}{\vocstyle{baseCost}}
141\newcommand{\capacityCost}{\vocstyle{capacityCost}}
142\newcommand{\durationCost}{\vocstyle{durationCost}}
143\newcommand{\fixedCost}{\vocstyle{fixedCost}}
144\newcommand{\maxVotes}{\vocstyle{maxVotes}}
145\newcommand{\maxDuration}{\vocstyle{maxDuration}}
146\newcommand{\numSequencers}{\vocstyle{numSequencers}}
147\newcommand{\processDuration}{\vocstyle{processDuration}}
148\newcommand{\reimbursement}{\vocstyle{reimbursement}}
149\newcommand{\securityCost}{\vocstyle{securityCost}}
150\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
151\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
152\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
153\newcommand{\totalCost}{\vocstyle{totalCost}}
154\newcommand{\totalReward}{\vocstyle{totalReward}}
155\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
156\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
157\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
158\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
159\newcommand{\votes}{\vocstyle{votes}}
160\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
161
162% Misc
163\newcommand{\davinci}{DAVINCI\xspace}
164\newcommand{\Davinci}{DAVINCI\xspace}
165
166% Draft watermark
167%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
168
169% New foonote referencing a previous footmark
170\makeatletter
171\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
172\makeatother