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
 71% Ballot protocol
 72\newcommand{\ballotstyle}[1]{\texttt{#1}\xspace}
 73\newcommand{\maxcount}{\ballotstyle{maxCount}}
 74\newcommand{\maxvalue}{\ballotstyle{maxValue}}
 75\newcommand{\minvalue}{\ballotstyle{minValue}}
 76\newcommand{\uniquevalues}{\ballotstyle{uniqueValues}}
 77\newcommand{\maxtotalcost}{\ballotstyle{maxTotalCost}}
 78\newcommand{\mintotalcost}{\ballotstyle{minTotalCost}}
 79\newcommand{\costexponent}{\ballotstyle{costExponent}}
 80
 81% Voting protocol
 82\newcommand{\variablestyle}[1]{\texttt{#1}\xspace}
 83\newcommand{\vote}{\variablestyle{vote}}
 84\newcommand{\processid}{\variablestyle{processID}}
 85\newcommand{\censuspf}{\variablestyle{censusProof}}
 86\newcommand{\commitment}{\variablestyle{identityCommitment}}
 87\newcommand{\nullifier}{\variablestyle{nullifier}}
 88\newcommand{\encryptedballot}{\variablestyle{encryptedBallot}}
 89\newcommand{\zkproof}{\variablestyle{ZKproof}}
 90\newcommand{\signature}{\variablestyle{signature}}
 91
 92% State Merkle tree
 93\newcommand{\censusroot}{\variablestyle{censusRoot}}
 94\newcommand{\type}{\variablestyle{type}}
 95\newcommand{\ballotmode}{\variablestyle{ballotMode}}
 96\newcommand{\epk}{\variablestyle{encryptionKey}}
 97\newcommand{\addaccumulator}{\variablestyle{addedResultsAccumulator}}
 98\newcommand{\substractaccumulator}{\variablestyle{substractResultsAccumulator}}
 99\newcommand{\addresses}{\variablestyle{addresses}}
100\newcommand{\nullifiers}{\variablestyle{nullifiers}}
101
102
103% Others
104\newcommand{\noi}{\noindent}
105\newcommand{\conc}{\:||\:}
106
107% Hyperlinks
108\newcommand{\hlset}[1]{\hypertarget{\detokenize{#1}}{#1}}
109\newcommand{\hlget}[1]{\hyperlink{\detokenize{#1}}{#1}}
110
111% Cryptographic primitives
112\newcommand{\methodstyle}[1]{{\sf{#1}}\xspace}
113\newcommand{\Enc}{\methodstyle{Enc}}
114\newcommand{\Dec}{\methodstyle{Dec}}
115\newcommand{\GenerateShares}{\methodstyle{GenerateShares}}
116\newcommand{\VerifyShare}{\methodstyle{VerifyShare}}
117\newcommand{\DerivePublicKey}{\methodstyle{DerivePublicKey}}
118\newcommand{\DeriveSecretShare}{\methodstyle{DeriveSecretShare}}
119
120\newcommand{\blinder}[1][]{{\sf{blinder}^{#1}}}
121\newcommand{\pk}[1][]{{\sf{pk}^{#1}}}
122\newcommand{\sk}[1][]{{\sf{sk}^{#1}}} 
123\newcommand{\msg}[1][]{{\sf{message}^{#1}}}
124\newcommand{\enc}[1][]{{\sf{ciphertext}^{#1}}}
125\newcommand{\sample}{\xleftarrow{\$}}
126
127% VOC token
128\newcommand{\vocstyle}[1]{{\sf{#1}}\xspace}
129
130\newcommand{\baseCost}{\vocstyle{baseCost}}
131\newcommand{\capacityCost}{\vocstyle{capacityCost}}
132\newcommand{\durationCost}{\vocstyle{durationCost}}
133\newcommand{\fixedCost}{\vocstyle{fixedCost}}
134\newcommand{\maxVotes}{\vocstyle{maxVotes}}
135\newcommand{\maxDuration}{\vocstyle{maxDuration}}
136\newcommand{\numSequencers}{\vocstyle{numSequencers}}
137\newcommand{\processDuration}{\vocstyle{processDuration}}
138\newcommand{\reimbursement}{\vocstyle{reimbursement}}
139\newcommand{\securityCost}{\vocstyle{securityCost}}
140\newcommand{\sequencerReward}{\vocstyle{sequencerReward}}
141\newcommand{\slashedAmount}{\vocstyle{slashedAmount}}
142\newcommand{\stakedCollateral}{\vocstyle{stakedCollateral}}
143\newcommand{\totalCost}{\vocstyle{totalCost}}
144\newcommand{\totalReward}{\vocstyle{totalReward}}
145\newcommand{\totalRewrites}{\vocstyle{totalRewrites}}
146\newcommand{\totalSequencers}{\vocstyle{totalSequencers}}
147\newcommand{\totalVotingProcesses}{\vocstyle{totalVotingProcesses}}
148\newcommand{\usedSequencers}{\vocstyle{usedSequencers}}
149\newcommand{\votes}{\vocstyle{votes}}
150\newcommand{\voteRewrites}{\vocstyle{voteRewrites}}
151
152% Misc
153\newcommand{\davinci}{DAVINCI\xspace}
154\newcommand{\Davinci}{DAVINCI\xspace}
155
156% Draft watermark
157%\ifdraft{\SetWatermarkScale{4}}{\SetWatermarkScale{0}}
158
159% New foonote referencing a previous footmark
160\makeatletter
161\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
162\makeatother