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{\censusproof}{\variablestyle{censusProof}}
 91\newcommand{\authenticationproof}{\variablestyle{authenticationProof}}
 92\newcommand{\voteid}{\variablestyle{voteID}}
 93\newcommand{\ballot}{\variablestyle{ballot}}
 94\newcommand{\vote}{\variablestyle{vote}}
 95\newcommand{\processid}{\variablestyle{processID}}
 96\newcommand{\censuspf}{\variablestyle{censusProof}}
 97\newcommand{\commitment}{\variablestyle{identityCommitment}}
 98\newcommand{\nullifier}{\variablestyle{nullifier}}
 99\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
100\newcommand{\zkproof}{\variablestyle{ZKproof}}
101\newcommand{\signature}{\variablestyle{signature}}
102\newcommand{\address}{\variablestyle{address}}
103
104% State Merkle tree
105\newcommand{\censusroot}{\variablestyle{censusRoot}}
106\newcommand{\type}{\variablestyle{type}}
107\newcommand{\ballotmode}{\variablestyle{ballotMode}}
108\newcommand{\epk}{\variablestyle{encryptionKey}}
109\newcommand{\addaccumulator}{\variablestyle{addedResultsAccumulator}}
110\newcommand{\substractaccumulator}{\variablestyle{substractResultsAccumulator}}
111\newcommand{\addresses}{\variablestyle{addresses}}
112\newcommand{\nullifiers}{\variablestyle{nullifiers}}
113\newcommand{\weight}{\variablestyle{weight}}
114
115% Others
116\newcommand{\noi}{\noindent}
117\newcommand{\conc}{\:||\:}
118
119% Hyperlinks
120\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
121\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
122
123% Cryptographic primitives
124\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
125\newcommand{\Keccak}{\methodstyle{Hash_1}}
126\newcommand{\Poseidon}{\methodstyle{Hash_2}}
127\newcommand{\Mimc}{\methodstyle{Hash_3}}
128\newcommand{\Enc}{\methodstyle{Enc}}
129\newcommand{\Dec}{\methodstyle{Dec}}
130\newcommand{\EncAdd}{\methodstyle{EncAdd}}
131\newcommand{\ReEnc}{\methodstyle{ReEnc}}
132\newcommand{\SSign}{\methodstyle{S.Sign}}
133\newcommand{\SVer}{\methodstyle{S.Verify}}
134\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
135\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
136\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
137\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
138
139\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
140\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
141\newcommand{\sk}[1][]{{\sf{sk}^{#1}}} 
142\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
143\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
144\newcommand{\sample}{\xleftarrow{\$}}
145
146% VOC token
147\newcommand{\token}{VOC\xspace}
148\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
149\newcommand{\baseCost}{\vocstyle{baseCost}}
150\newcommand{\capacityCost}{\vocstyle{capacityCost}}
151\newcommand{\durationCost}{\vocstyle{durationCost}}
152\newcommand{\fixedCost}{\vocstyle{fixedCost}}
153\newcommand{\maxVotes}{\vocstyle{maxVotes}}
154\newcommand{\maxDuration}{\vocstyle{maxDuration}}
155\newcommand{\numSequencers}{\vocstyle{numSequencers}}
156\newcommand{\processDuration}{\vocstyle{processDuration}}
157\newcommand{\reimbursement}{\vocstyle{reimbursement}}
158\newcommand{\securityCost}{\vocstyle{securityCost}}
159\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
160\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
161\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
162\newcommand{\totalCost}{\vocstyle{totalCost}}
163\newcommand{\totalReward}{\vocstyle{totalReward}}
164\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
165\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
166\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
167\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
168\newcommand{\votes}{\vocstyle{votes}}
169\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
170
171% Misc
172\newcommand{\davinci}{DAVINCI\xspace}
173\newcommand{\Davinci}{DAVINCI\xspace}
174
175% Draft watermark
176%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
177
178% New foonote referencing a previous footmark
179\makeatletter
180\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
181\makeatother