mirror of
https://gitlab.com/MisterBiggs/latex-bingo.git
synced 2025-08-02 11:31:28 +00:00
Small changes to README. Added list of VP terms and modified Presidential terms.
This commit is contained in:
38
README.md
38
README.md
@@ -9,8 +9,11 @@ was taken from [tex.stackexchange.com](http://tex.stackexchange.com/questions/63
|
|||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
The list of phrases (and don't make any individual phrase very long) needs to be semicolon-separated text,
|
The list of phrases (and don't make any individual phrase very long)
|
||||||
with a small bit of LaTeX encompassing the list.
|
needs to be semicolon-separated text, with a small bit of LaTeX
|
||||||
|
encompassing the list. You can make the list about anything; I have
|
||||||
|
added a vice-presidential list too, but the relevant words will always
|
||||||
|
change.
|
||||||
|
|
||||||
```LaTeX
|
```LaTeX
|
||||||
\myItems{Believe me;
|
\myItems{Believe me;
|
||||||
@@ -31,8 +34,10 @@ The list should terminate only with a close-brace, though the brace can be on a
|
|||||||
|
|
||||||
The LaTeX file, when run, will take the list, pick 24 at random
|
The LaTeX file, when run, will take the list, pick 24 at random
|
||||||
(the "Free Space" is humorously listed as _"Candidate Talks Past Allotted Time"_,
|
(the "Free Space" is humorously listed as _"Candidate Talks Past Allotted Time"_,
|
||||||
as though that could ever _not_ happen), and assign them to a standard 5 x 5 bingo card.
|
as though that could ever _not_ happen), and assign them to a
|
||||||
This random process is nice because it avoids "sets" of cards all providing Bingo at the same time.
|
standard 5 x 5 bingo card. This random process is nice because it avoids
|
||||||
|
"sets" of cards all providing Bingo at the same time.
|
||||||
|
|
||||||
The LaTeX file includes a for-loop to create some number (initially set at 50) of PDF cards.
|
The LaTeX file includes a for-loop to create some number (initially set at 50) of PDF cards.
|
||||||
|
|
||||||
## Customizing the Code
|
## Customizing the Code
|
||||||
@@ -64,24 +69,31 @@ If you want to use an arbitrary "Free Space" label, you can change the
|
|||||||
\node [scale=1.2] at ($(\col,-\row)-(0.5,0.7)$) {Entirely};
|
\node [scale=1.2] at ($(\col,-\row)-(0.5,0.7)$) {Entirely};
|
||||||
```
|
```
|
||||||
|
|
||||||
For those wholly new to TikZ, the second number of the pair is a y-coordinate for the line,
|
And note there is a `\renewcommand` you can uncomment for a totally generic "Free Space" square.
|
||||||
and a line space of 0.2 is about right.
|
|
||||||
If you trim the cell to two lines, you will want to change the y-values to be more centered.
|
For those wholly new to TikZ, the second number of the pair is a y-coordinate
|
||||||
|
for the line, and a line space of 0.2 is about right.
|
||||||
|
If you trim the cell to two lines, you will want to change the y-values
|
||||||
|
to be more centered.
|
||||||
|
|
||||||
## The Master Checklist
|
## The Master Checklist
|
||||||
|
|
||||||
The python script parses the entire list and provides a ```longtable``` checklist for the moderator to use
|
The python script parses the entire list and provides a ```longtable```
|
||||||
when evaluating a given event.
|
checklist for the moderator to use when evaluating a given event.
|
||||||
The ```bingochecklist.tex``` file reads the output of the python script, which is a file called ```checklist1.tex```.
|
The ```bingochecklist.tex``` file reads the output of the python script,
|
||||||
|
which is a file called ```checklist1.tex```.
|
||||||
|
|
||||||
So, from a terminal on your machine of choice, run
|
So, from a terminal on your machine of choice, run
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
python makechecklist.py
|
python makechecklist.py
|
||||||
```
|
```
|
||||||
|
|
||||||
And if you've got all the files where they are supposed to be, it will form up the guts of the checklist.
|
And if you've got all the files where they are supposed to be, it will
|
||||||
|
form up the guts of the checklist.
|
||||||
Next, compile ```bingochecklist.tex``` a few times and you'll be good to go.
|
Next, compile ```bingochecklist.tex``` a few times and you'll be good to go.
|
||||||
You need to compile the TeX file at least twice because it uses ```longtable```, and column widths are determined
|
You need to compile the TeX file at least twice because it uses
|
||||||
dynamically over the course of a few LaTeX compiles.
|
```longtable```, and column widths are determined dynamically over
|
||||||
|
the course of a few LaTeX compiles.
|
||||||
|
|
||||||
Jesse Hamner, 2016. :rocket:
|
Jesse Hamner, 2016. :rocket:
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
\relax
|
|
BIN
bingocards.pdf
BIN
bingocards.pdf
Binary file not shown.
Binary file not shown.
122
bingocards.tex
122
bingocards.tex
@@ -4,7 +4,8 @@
|
|||||||
% mostly stolen from
|
% mostly stolen from
|
||||||
% http://tex.stackexchange.com/questions/63357/automatically-generated-bingo-cards
|
% http://tex.stackexchange.com/questions/63357/automatically-generated-bingo-cards
|
||||||
%
|
%
|
||||||
% with a few additions myself
|
% but cleaned up a little, and with a few additions.
|
||||||
|
%
|
||||||
% Jesse Hamner, 2016
|
% Jesse Hamner, 2016
|
||||||
|
|
||||||
\usepackage{xstring}
|
\usepackage{xstring}
|
||||||
@@ -13,9 +14,13 @@
|
|||||||
\usetikzlibrary{calc}
|
\usetikzlibrary{calc}
|
||||||
\usepackage{xparse}
|
\usepackage{xparse}
|
||||||
|
|
||||||
\input{random.tex}
|
\input{random.tex} % this isn't supposed to exist yet, so if you get errors about it, ignore them
|
||||||
\newcount\randomnum
|
\newcount\randomnum
|
||||||
\ExplSyntaxOn
|
% The LaTeX3 coding language, -expl3-, uses : and _ as 'letters' in
|
||||||
|
% function and variable names.
|
||||||
|
% setting expl syntax to "on" allows use of -expl3- code-level material
|
||||||
|
% in a document.
|
||||||
|
\ExplSyntaxOn % underscores are no longer a problem, for one thing
|
||||||
|
|
||||||
\seq_new:N \g_my_items_seq
|
\seq_new:N \g_my_items_seq
|
||||||
\seq_new:N \l_my_tmp_items_seq
|
\seq_new:N \l_my_tmp_items_seq
|
||||||
@@ -27,86 +32,111 @@
|
|||||||
\cs_generate_variant:Nn \seq_remove_all:Nn {Nx}
|
\cs_generate_variant:Nn \seq_remove_all:Nn {Nx}
|
||||||
|
|
||||||
\NewDocumentCommand {\myItems} {m}
|
\NewDocumentCommand {\myItems} {m}
|
||||||
|
{
|
||||||
|
\seq_clear:N \g_my_items_seq % clear item list
|
||||||
|
\seq_gset_split:Nnn \g_my_items_seq {;} {#1} % put item list into g_my_items_seq
|
||||||
|
\int_compare:nNnT {\seq_count:N \g_my_items_seq} < {24} % check whether there are enough items
|
||||||
{
|
{
|
||||||
\seq_clear:N \g_my_items_seq % clear item list
|
\msg_error:nn {bingo} {Too~few~items!}
|
||||||
\seq_gset_split:Nnn \g_my_items_seq {;} {#1} % put item list in seq
|
}
|
||||||
\int_compare:nNnT {\seq_count:N \g_my_items_seq} < {24} {\msg_error:nn {bingo} {Too~few~items!}} % check whether there are enough items
|
}
|
||||||
}
|
|
||||||
|
|
||||||
\NewDocumentCommand{\setItems}{}
|
\NewDocumentCommand{\setItems}{}
|
||||||
{
|
{
|
||||||
\seq_set_eq:NN \l_my_tmp_items_seq \g_my_items_seq % put in temp seq so that multiple cards can be produced
|
\seq_set_eq:NN \l_my_tmp_items_seq \g_my_items_seq % put in temp seq so that multiple cards can be produced
|
||||||
\prg_replicate:nn {24} %generate random list of 24 items
|
\prg_replicate:nn {24} % generate random list of 24 items
|
||||||
{
|
{
|
||||||
\int_set:Nn \l_tmp_int {\seq_count:N \l_my_tmp_items_seq}% set current length of list
|
\int_set:Nn \l_tmp_int {\seq_count:N \l_my_tmp_items_seq} % set current length of list
|
||||||
\setrannum{\randomnum}{1}{\int_use:N \l_tmp_int} % choose random num up to length of seq
|
\setrannum{\randomnum}{1}{ % choose random num up to length of seq
|
||||||
\seq_put_right:Nx \g_my_randomized_seq {\seq_item:Nn \l_my_tmp_items_seq {\the\randomnum}}% grab corresponding item and put in tmp seq
|
\int_use:N \l_tmp_int
|
||||||
\seq_remove_all:Nx \l_my_tmp_items_seq {\seq_item:Nn \l_my_tmp_items_seq {\the\randomnum}}%delete that item from temp seq
|
}
|
||||||
|
\seq_put_right:Nx \g_my_randomized_seq { % grab corresponding item and put in tmp seq
|
||||||
|
\seq_item:Nn \l_my_tmp_items_seq {\the\randomnum}
|
||||||
|
}
|
||||||
|
\seq_remove_all:Nx \l_my_tmp_items_seq { % delete that item from temp seq
|
||||||
|
\seq_item:Nn \l_my_tmp_items_seq {\the\randomnum}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
\seq_clear:N \l_my_tmp_items_seq %clear temp seq when done
|
\seq_clear:N \l_my_tmp_items_seq % clear temp seq when done
|
||||||
}
|
}
|
||||||
|
|
||||||
\NewDocumentCommand {\NodeText}{}
|
\NewDocumentCommand {\NodeText}{}
|
||||||
{
|
{
|
||||||
\seq_gpop_right:NN \g_my_randomized_seq \l_tmpa_tl %pop item from randomized seq into token list
|
\seq_gpop_right:NN \g_my_randomized_seq \l_tmpa_tl % pop item from randomized seq into token list
|
||||||
\tl_use:N \l_tmpa_tl %use that item.
|
\tl_use:N \l_tmpa_tl % use that item.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
\ExplSyntaxOff
|
\ExplSyntaxOff
|
||||||
|
|
||||||
|
|
||||||
\def\NumOfColumns{5}%
|
\def\NumOfColumns{5}%
|
||||||
\def\Sequence{1, 2, 3, 4, 5}%
|
\def\Sequence{1, 2, 3, 4, 5}%
|
||||||
\newcommand{\sep}{1mm}
|
\newcommand{\sep}{1mm}
|
||||||
|
|
||||||
% make a nice identifier for the card (in case, say, there is more than one
|
% make a nice identifier for the card (perhaps there is more than one
|
||||||
% presidential debate, etc.)
|
% presidential debate, etc.)
|
||||||
\newcommand{\biglabel}{\vspace{0.2in}\begin{center}
|
\newcommand{\biglabel}{\vspace{0.2in}\begin{center}
|
||||||
\begin{LARGE}
|
\begin{LARGE}
|
||||||
Rawlins Hall Bingo
|
Rawlins Hall Bingo
|
||||||
|
|
||||||
Vice-Presidential Debate
|
Second Presidential Debate
|
||||||
|
|
||||||
4 October 2016
|
9 October 2016
|
||||||
|
|
||||||
\end{LARGE}
|
\end{LARGE}
|
||||||
\end{center}
|
\end{center}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\newcommand{\freespace}{
|
||||||
|
\filldraw[fill=gray!35, draw=black] ($(\col,-\row)-(1,1)$) rectangle ($(\col,-\row)$) ;
|
||||||
|
% "Free Space" -- that's the joke:
|
||||||
|
\node [scale=1.2] at ($(\col,-\row)-(0.5,0.3)$) {Candidate};
|
||||||
|
\node [scale=1.2] at ($(\col,-\row)-(0.5,0.5)$) {Talks Past};
|
||||||
|
\node [scale=1.2] at ($(\col,-\row)-(0.5,0.7)$) {Allotted Time};
|
||||||
|
}
|
||||||
|
|
||||||
|
% If you want a more standard free space square:
|
||||||
|
%\renewcommand{\freespace}{
|
||||||
|
% \filldraw[fill=gray!35, draw=black] ($(\col,-\row)-(1,1)$) rectangle ($(\col,-\row)$) ;
|
||||||
|
% \node [scale=1.2] at ($(\col,-\row)-(0.5,0.4)$) {Free};
|
||||||
|
% \node [scale=1.2] at ($(\col,-\row)-(0.5,0.6)$) {Space};
|
||||||
|
%}
|
||||||
|
|
||||||
% Although it doesn't save any code by breaking this out into its own
|
% Although it doesn't save any code by breaking this out into its own
|
||||||
% function (subroutine), it makes the code easier to parse down below
|
% function (subroutine), it makes the code easier to parse down below
|
||||||
% in the for loop:
|
% in the for loop:
|
||||||
\newcommand{\drawthecard}{\begin{tikzpicture}[draw=black, thick, x=\Size,y=\Size]
|
\newcommand{\drawthecard}{
|
||||||
\foreach \row in \Sequence{%
|
\begin{tikzpicture}[draw=black, thick, x=\Size,y=\Size]
|
||||||
\foreach \col in \Sequence {%
|
\foreach \row in \Sequence{%
|
||||||
\pgfmathtruncatemacro{\value}{\col+\NumOfColumns*(\row-1)}
|
\foreach \col in \Sequence {%
|
||||||
\pgfmathsetmacro{\ColRowProduce}{\col*\row}
|
\pgfmathtruncatemacro{\value}{\col+\NumOfColumns*(\row-1)}
|
||||||
\IfEq{\ColRowProduce}{9}{% If is center square:
|
\pgfmathsetmacro{\ColRowProduce}{\col*\row} % 3 x 3 = 9
|
||||||
\filldraw[fill=gray!35, draw=black] ($(\col,-\row)-(1,1)$) rectangle ($(\col,-\row)$) ;
|
\IfEq{\ColRowProduce}{9}{% If is center square, do the \freespace command:
|
||||||
% "Free Space" -- that's the joke:
|
\freespace
|
||||||
\node [scale=1.2] at ($(\col,-\row)-(0.5,0.3)$) {Candidate};
|
}
|
||||||
\node [scale=1.2] at ($(\col,-\row)-(0.5,0.5)$) {Talks Past};
|
{ % if it is not the center square:
|
||||||
\node [scale=1.2] at ($(\col,-\row)-(0.5,0.7)$) {Allotted Time}; }{
|
\node [Square] at ($(\col,-\row)-(0.5,0.5)$) {\large \NodeText};
|
||||||
\node [Square] at ($(\col,-\row)-(0.5,0.5)$) {\large \NodeText};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
\end{tikzpicture}
|
\end{tikzpicture}
|
||||||
}
|
}
|
||||||
|
|
||||||
\newcommand{\Size}{3.1cm}
|
\newcommand{\Size}{3.1cm}
|
||||||
\newcommand{\Sizeinner}{3.0cm}
|
\newcommand{\Sizeinner}{3.0cm}
|
||||||
|
|
||||||
\tikzset{Square/.style={
|
\tikzset{Square/.style={
|
||||||
inner sep=0pt,
|
inner sep=0pt,
|
||||||
text width=\Sizeinner,
|
text width=\Sizeinner,
|
||||||
minimum size=\Size,
|
minimum size=\Size,
|
||||||
draw=black,
|
draw=black,
|
||||||
align=center,
|
align=center
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
\pagestyle{empty}
|
\pagestyle{empty}
|
||||||
|
|
||||||
%\myItems{this;will;produce;an;error;because;there;aren't;enough;items}
|
%\myItems{this;will;produce;an;error;because;there;aren't;enough;items}
|
||||||
|
|
||||||
% These items should be contained in a separate file, formatted
|
% These items should be contained in a separate file, formatted
|
||||||
@@ -122,13 +152,13 @@ align=center,
|
|||||||
\foreach \n in {0,...,49}{
|
\foreach \n in {0,...,49}{
|
||||||
|
|
||||||
% select and randomize the entries:
|
% select and randomize the entries:
|
||||||
\setItems
|
\setItems
|
||||||
|
|
||||||
% actually draw the card:
|
% actually draw the card:
|
||||||
\drawthecard
|
\drawthecard
|
||||||
|
|
||||||
% add the label text:
|
% add the label text:
|
||||||
\biglabel
|
\biglabel
|
||||||
|
|
||||||
} % done with the loop
|
} % done with the loop
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@ Israel;
|
|||||||
Iran;
|
Iran;
|
||||||
Mexico;
|
Mexico;
|
||||||
Russia;
|
Russia;
|
||||||
|
North Korea;
|
||||||
%Candidate talks past allotted time;
|
%Candidate talks past allotted time;
|
||||||
%Moderator interrupts candidate;
|
%Moderator interrupts candidate;
|
||||||
Moderator becomes visibly frustrated;
|
Moderator becomes visibly frustrated;
|
||||||
@@ -47,6 +48,26 @@ Bernie Sanders;
|
|||||||
Elizabeth Warren;
|
Elizabeth Warren;
|
||||||
Mike Pence;
|
Mike Pence;
|
||||||
Paid family leave;
|
Paid family leave;
|
||||||
|
Alliances;
|
||||||
|
Missile Defense;
|
||||||
|
America's place in the world;
|
||||||
|
Small Town;
|
||||||
|
Single-payer Healthcare;
|
||||||
|
More of the Same;
|
||||||
|
National Debt;
|
||||||
|
Trade Deals;
|
||||||
|
Infrastructure;
|
||||||
|
Clean Energy;
|
||||||
|
War on Coal;
|
||||||
|
Privatize Social Security;
|
||||||
|
Community Policing;
|
||||||
|
Stop and Frisk;
|
||||||
|
Law and Order;
|
||||||
|
Implicit Bias;
|
||||||
|
Institutional Racism;
|
||||||
|
Open Borders;
|
||||||
|
I have a plan;
|
||||||
|
Bipartisan;
|
||||||
%Shot of Bill Clinton in audience;
|
%Shot of Bill Clinton in audience;
|
||||||
%Shot of Chelsea Clinton in audience;
|
%Shot of Chelsea Clinton in audience;
|
||||||
%Shot of Melania Trump in audience;
|
%Shot of Melania Trump in audience;
|
||||||
|
@@ -21,6 +21,7 @@ $\square$ & Israel \\[\sep]
|
|||||||
$\square$ & Iran \\[\sep]
|
$\square$ & Iran \\[\sep]
|
||||||
$\square$ & Mexico \\[\sep]
|
$\square$ & Mexico \\[\sep]
|
||||||
$\square$ & Russia \\[\sep]
|
$\square$ & Russia \\[\sep]
|
||||||
|
$\square$ & North Korea \\[\sep]
|
||||||
$\square$ & Moderator becomes visibly frustrated \\[\sep]
|
$\square$ & Moderator becomes visibly frustrated \\[\sep]
|
||||||
$\square$ & Candidate demands an apology \\[\sep]
|
$\square$ & Candidate demands an apology \\[\sep]
|
||||||
$\square$ & Heckler interrupts debate \\[\sep]
|
$\square$ & Heckler interrupts debate \\[\sep]
|
||||||
@@ -42,6 +43,26 @@ $\square$ & Bernie Sanders \\[\sep]
|
|||||||
$\square$ & Elizabeth Warren \\[\sep]
|
$\square$ & Elizabeth Warren \\[\sep]
|
||||||
$\square$ & Mike Pence \\[\sep]
|
$\square$ & Mike Pence \\[\sep]
|
||||||
$\square$ & Paid family leave \\[\sep]
|
$\square$ & Paid family leave \\[\sep]
|
||||||
|
$\square$ & Alliances \\[\sep]
|
||||||
|
$\square$ & Missile Defense \\[\sep]
|
||||||
|
$\square$ & America's place in the world \\[\sep]
|
||||||
|
$\square$ & Small Town \\[\sep]
|
||||||
|
$\square$ & Single-payer Healthcare \\[\sep]
|
||||||
|
$\square$ & More of the Same \\[\sep]
|
||||||
|
$\square$ & National Debt \\[\sep]
|
||||||
|
$\square$ & Trade Deals \\[\sep]
|
||||||
|
$\square$ & Infrastructure \\[\sep]
|
||||||
|
$\square$ & Clean Energy \\[\sep]
|
||||||
|
$\square$ & War on Coal \\[\sep]
|
||||||
|
$\square$ & Privatize Social Security \\[\sep]
|
||||||
|
$\square$ & Community Policing \\[\sep]
|
||||||
|
$\square$ & Stop and Frisk \\[\sep]
|
||||||
|
$\square$ & Law and Order \\[\sep]
|
||||||
|
$\square$ & Implicit Bias \\[\sep]
|
||||||
|
$\square$ & Institutional Racism \\[\sep]
|
||||||
|
$\square$ & Open Borders \\[\sep]
|
||||||
|
$\square$ & I have a plan \\[\sep]
|
||||||
|
$\square$ & Bipartisan \\[\sep]
|
||||||
$\square$ & Free market \\[\sep]
|
$\square$ & Free market \\[\sep]
|
||||||
$\square$ & Bankruptcy \\[\sep]
|
$\square$ & Bankruptcy \\[\sep]
|
||||||
$\square$ & Taxes \\[\sep]
|
$\square$ & Taxes \\[\sep]
|
||||||
|
Reference in New Issue
Block a user