Yes, we are talking about TeX and friends!
Edit: I decided to move the background motivation to the end of the question, since it seems to be kind of off-topic in the TeX context.
The following code is just a preliminary idea. My plan is to hide a notebook inside the Sistine Chapel, open a spreadsheet application and start to count votes for the new pope election.
The following list contains the name of the 115 candidates to become the new pope. In the whole process, data is manually tabulated according to the voting ballots, and every cardinal annotates in his own vota scrutinii the number of votes for each candidate. It's still ruled by ink and paper.
Now, it's just a matter of exporting data to .csv
and use Nicola Talbot's awesome datatool
package in order to generate a beautiful report for the cardinals! But wait a minute, we still need to keep up the tradition, ink and pen.
Thanks to my buddy percusse, it's TikZ time! Let's fake some handwriting annotation for the votes! The idea here is very simple: get the number of votes, generate a TikZ picture with a visual representation of the current number and present it.
First things first. Here it is cardinals.csv
:
Surname,Name,Votes
Kasper,Walter,0
Poletto,Severino,0
Sandoval Íñiguez,Juan,0
Danneels,Godfried,0
Errázuriz ossa,Francisco Javier,0
Farina,Raffaele,0
Agnelo,Geraldo Majella,7
Meisner,Joachim,0
Vela Chiriboga,Raúl Eduardo,0
Re,Giovanni Battista,0
Tettamanzi,Dionigi,0
Monterisi,Francesco,0
Hummes,Cláudio,15
Amigo Vallejo,Carlos,0
Sardi,Paolo,0
Cordes,Paul Josef,0
Rodé,Franc,0
Bertone,Tarcisio,11
Pham Minh Mân,Jean-Baptiste,0
Lajolo,Giovanni,0
Naguib,Antonios,0
Rigali,Justin Francis,0
De Paolis,Velasio,0
Abril y Castelló,Santos,0
da Cruz Policarpo,José ,0
Mahony,Roger Michael,0
Terrazas Sandoval,Julio,0
Dias,Ivan,0
Lehmann,Karl,0
Levada,William Joseph,0
Okogie,Anthony Olubunmi,0
Turcotte,Jean-Claude,0
Rouco Varela,Antonio María,0
Ortega y Alamino,Jaime Lucas,0
López Rodrígues,Nicolás de Jesús,0
Antonelli,Ennio,0
Sarr,Théodore-Adrien,0
Bergoglio,Jorge Mario,0
George,Francis Eugene,0
Bačkis,Audrys Juozas,0
Damasceno Assis,Raymundo,7
Nicora,Attilio,0
Martínez Sistach,Lluís,0
Vegliò,Antonio Maria,0
Romeo,Paolo,0
Coccopalmerio,Francesco,0
Monteiro de Castro,Manuel,0
Caffarra,Carlo,0
Amato,Angelo,0
O'Brien,Edwin Frederik,0
Dziwisz,Stanisław,29
Tong Hon,John,0
Brady,Seán Baptist,0
Monsengwo,Pasinya Laurent,0
Grocholewsky,Zenon,0
Toppo,Telesphore Placidus,0
Raï,Béchara Boutros,0
Vallini,Agostino,0
Wuerl,Donald William,0
Zubeir Wako,Gabriel,0
Napier,Wilfrid Fox,0
Pell,George,0
Scola,Angelo,0
Rivera Carrera,Norberto,0
Urosa Savino,Jorge Liberato,0
Salazar Gómez,Rubén,0
Bertello,Giuseppe,0
Ravasi,Gianfranco,0
Vingt-Trois,André,0
Rodríguez Maradiaga,Óscar Andrés,0
Bagnasco,Angelo,0
Calcagno,Domenico,0
Duka,Dominik,0
Sepe,Crescenzio,0
Tauran,Jean-Louis,0
Versaldi,Giuseppe,0
Comastri,Angelo,0
Sandri,Leonardo,0
Cipriani Thorne,Juan Luis,0
Onaiyekan,John Olorunfemi,0
Ouellet,Marc,0
O’Malley,Sean Patrick,0
Pengo,Polycarp,0
Piacenza,Mauro,0
Ricard,Jean-Pierre,0
Gracias,Oswald,0
Njue,John,0
Schönborn,Christoph,0
Alencherry,George,0
Sarah,Robert,0
Ryłko,Stanisław,0
Puljić,Vinko,0
Cañizares Llovera,Antonio,0
Filoni,Fernando,0
Collins,Thomas Christopher,0
Betori,Giuseppe,0
Braz de Avis,João,21
Patabendige Don,Albert Malcolm Ranjith,0
Burke,Raymond Leo,0
Turkson,Peter Kodwo Appiah,0
Robles Ortega,Francisco,0
Bozanić,Josip,0
DiNardo,Daniel Nicholas,0
Scherer,Odilo Pedro,37
Harvey,James Michael,0
Nycz,Kazimierz,0
Dolan,Timothy Michael,2
Koch,Kurt,0
Barbarin,Philippe,0
Erdő,Péter,0
Eijk,Willem Jacobus,0
Marx,Reinhard,0
Woelki,Rainer Maria,0
Tagle,Luis Antonio,0
Thottunkal,Baselios Cleemis,0
And now, our beloved vota.tex
:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[top=1.5cm, bottom=1.5cm, left=1.5cm, right=1.5cm, landscape]{geometry}
\usepackage{lmodern}
\usepackage{datatool}
\usepackage{multicol}
\usepackage{xspace}
\usepackage{tikz}
\usetikzlibrary{calc,decorations}
\makeatletter
\pgfdeclaredecoration{penciline}{initial}{
\state{initial}[width=+\pgfdecoratedinputsegmentremainingdistance,auto corner on length=1mm,]{\pgfpathcurveto{%
\pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}{\pgfdecorationsegmentamplitude}}{\pgfmathrand\pgfpointadd{%
\pgfqpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}}{\pgfqpoint{-\pgfdecorationsegmentaspect\pgfdecoratedinputsegmentremainingdistance}
{\pgfmathresult\pgfdecorationsegmentamplitude}}}{\pgfpointadd{\pgfpointdecoratedinputsegmentlast}{\pgfpoint{1pt}{1pt}}}}\state{final}{}}
\tikzset{
prison/.style={
append after command={
\pgfextra{\ifnum#1=0\else
\foreach \x in {0,...,\number\numexpr#1-1\relax}{
\coordinate (mytemp) at ($(\tikzlastnode.north west)!0.3333*\x!(\tikzlastnode.north east)$);
\draw[decorate] (mytemp) -- (mytemp|-\tikzlastnode.south);}\fi
}
}
},
fived/.style={append after command={
\pgfextra{
\draw[decorate] ([shift={(-2mm,1mm)}]\tikzlastnode.south west)--([shift={(2mm,-1mm)}]\tikzlastnode.north east);}
}
}
}
\makeatother
\newcommand{\drawvotes}[1]{%
\begin{tikzpicture}[decoration=penciline]
\def\numofscr{#1}
\pgfmathtruncatemacro\residue{Mod(\numofscr,5)}
\pgfmathtruncatemacro\numoflots{\numofscr/5}
\ifnum\numofscr<5\else
\foreach \x in {1,...,\numoflots}{
\node[prison=4,fived] (a) at (\x,0) {};
}
\fi
\node[prison=\residue] at (\numoflots+1,0) {};
\end{tikzpicture}
}
\DTLloaddb{cardinals}{cardinals.csv}
\begin{document}
\pagestyle{empty}
\begin{center}
{\Huge\textsc{Vota Scrutinii}}
\end{center}
\vspace{1em}
\begin{multicols}{2}
\begin{enumerate}
\DTLforeach{cardinals}{\surname=Surname,\name=Name,\votes=Votes}{%
\item \textsc{\surname\xspace\drawvotes{\votes}}}
\end{enumerate}
\end{multicols}
\end{document}
A taste of the output:
Let's highlight the voting part:
Yay, we just brought TeX and friends to the election of the pope! Now, I'd love to improve the code and add, if possible, the following features:
-
A cardinal is elected pope if he obtains 2/3 of all votes. If one the candidates reach this number, we could add a nice blue circle around his name in the list, and probably a note with Habemus Papam! near it. That way, the lazy cardinals will easily spot the elected one.
:)
-
If no one reaches 2/3 of the votes, at least we now have a perspective of the voting scheme, like the top voted cardinals, which will influence the next voting sessions. My idea is, if no cardinal reaches 2/3 of all votes, let's add a nice red circle around the names of the 5 top voted cardinals, so we can easily spot the trend going on.
:)
Feel free to add more features if you like. :)
Well, that's it. Hope you guys like the initial code and idea. :)
Now, we need to kindly ask egreg or Claudio Fiandrino to go to Rome and convince the cardinals to use our proposal. It will be way funnier. :)
Any help is appreciated. :)
Background
Being catholic, the election of a new pope is a milestone for me. Actually, with Pope Benedict XVI resigning, this will be the second election I watch – Pope John Paul II was elected in 1978, a few years before I was born, but of course I watched Cardinal Ratzinger being elected. :)
I even saw the white smoke on television!
My dad used to tell me a lot of stories from past elections. I think the whole process is quite amusing, specially the way cardinals vote for their candidates.
Cardinal José Freire Falcão, former archbishop of Brasília, gave a very nice interview to a Brazilian website in which he showed documents from the last conclave. This is the voting ballot, where the cardinal writes down the name of his choice. After every cardinal casts his vote, it's time to tabulate data! This is done in this other document, called vota scrutinii.
I'm almost sure the process is the very same done since the beginning of time, with ink and paper. But of course, how about giving them a little help with LaTeX and friends? :)
Best Answer
My
datatool
skills are limited, so the following solution uses TeX primitives and PGFs mathematical engine and also its\pgfutil@in@
macro/conditional.Interaction
Line 99: Minimum ratio a Cardinal needs to get elected as Pope.
Line 70: Number of Cardinals that will be marked if no one has reached the limit. As this will be used inside a
\foreach
loop it should be at least3
(→ Top 3).There are some explanations needed: If two or more Cardinals got the same number of votes they will both be added to the Top list. This means that, although the
numberOfTopCardinals
is set to, say5
, we could have six or more Cardinals in the Top 5 list. Aka “Tie”.The
\ifHabemusPapam
conditional can be used to check whether the limit of minimum votes has been reached by one of the Cardinals.The styles
papa
,not papa
andtop
as well asevery name
can be used to change the appearance of the list.How does it work?
Fairly simply:
\votesForPlace<place>
)\votesOfTopCardinals
macro will contain all number of votes that appear in the top list.\votesForPlace1
) is greater or equal than the amount needed. This will set\ifHabemusPapam
.\setStyleForVotes
):papa
.top
, otherwisenot papa
.every name
style.Code
Output