# Creating playing cards using TikZ

I'm creating a card game, specifically a computer science Fluxx variant, and want to generate the cards through *TeX. They should look like this:

In some of them I want to put some graphics or formulas.

I tried with TikZ but had no luck (but I'm just a newbie). Can you help me?

(I plan to release it under a CC license.)

UPDATE: This is what I have:

\documentclass{minimal}
\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{tikz}
\usepackage{multicol}
\usepackage{amsthm,amsmath,amssymb}
\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage[utf8]{inputenc}
\begin{document}
\tikzstyle{textstyle}=[rectangle, text width=3.5cm, text badly ragged, scale=0.8]
\begin{multicols}{3}
\begin{center}
\begin{tikzpicture}[background rectangle/.style = {draw=black, fill=white,
rounded corners}, show background rectangle, node distance=0.3cm]
\node (side) [textstyle, fill=red, rotate=90, text width=4cm, scale=1.4, text centered] {%
\begin{tabular}{r}
TIME
\end{tabular}
};
\node (kind) [textstyle, right=of side, scale=1.5] {\textbf{KEEPER}};
\node (desckind) [textstyle, below=of kind] {
When you play this card, bla bla bla.
};
\node (title) [textstyle, below=of desckind, scale=1.3] {Time};
\node (separator) [thick, fill=black, below=of title, text width=3.5cm] {};
\node (description) [textstyle, below=of separator] {
The player bla bla bla bla
$H \Psi = \nabla \Psi$
$J \Phi = \nabla \Phi$
and then bla bla bla.
};
\end{tikzpicture}
\end{center}
\end{multicols}
\end{document}


-
Can you show what you have tried so far, and exactly what you are having difficulty with? Is it the layout, the thick lines, the round edges, the larger font sizes, using colors? – Peter Grill Mar 13 '12 at 21:42
@PeterGrill my greatest problem is the layout and fixing card sizes. – Diego Mar 13 '12 at 21:59
@Diego: Which problems have you solved yet? – doncherry Mar 13 '12 at 22:10
Maybe ,this could be a good starting point for you: tex.stackexchange.com/a/47165/9237 – Speravir Mar 13 '12 at 22:40
Now I was just considering downvoting your question due to you littering the universe with yet another Fluxx version... 15 minutes of fun boiled down to 3 hours... OK, just kidding; but seriously: nice try, though you could choose an actually good game to do a variant of. Anyway, if you post your game on BGG, don't forget to mention TeX! – mbork Mar 13 '12 at 23:55
show 1 more comment

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usepackage{pifont}

\begin{document}

\pgfmathsetmacro{\cardwidth}{5}
\pgfmathsetmacro{\cardheight}{8}
\newcommand{\stripcolor}{lime}
\pgfmathsetmacro{\stripwidth}{0.7}
\newcommand{\striptext}{INTER ARMA \ding{74}}
\newcommand{\topcaption}{LATIN}
\newcommand{\topcontent}{\textit{''Inter Arma Enim Silent Leges''}}
\newcommand{\bottomcaption}{Inter Arma}
\newcommand{\bottomcontent}{In times of war, the law falls silent.\\ \tikz{\fill[even odd rule] (0,0) circle (0.3) (-0.2,-0.2) rectangle (0.2,0.2);}}
\pgfmathsetmacro{\ruleheight}{0.3}

\begin{tikzpicture}
\draw[rounded corners=0.2cm] (0,0) rectangle (\cardwidth,\cardheight);
{\LARGE \topcaption}\\
\topcontent\\
{\LARGE \bottomcaption}\\
\bottomcontent\\
};
\end{tikzpicture}

\end{document}


I used the pifont package for the star symbol (\ding{74}). It has also the other symbols depicted in your photograph, have a look here.

Edit 1: Now with a rotated symbol, and more options are set with keys:

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usepackage{pifont}
\usepackage{graphicx}

\begin{document}

\pgfmathsetmacro{\cardwidth}{5}
\pgfmathsetmacro{\cardheight}{8}
\newcommand{\stripcolor}{cyan}
\pgfmathsetmacro{\stripwidth}{1.2}
\newcommand{\striptext}{INTER ARMA \rotatebox[origin=c]{-90}{\ding{49}}}
\newcommand{\topcaption}{LATIN}
\newcommand{\topcontent}{\textit{''Inter Arma Enim Silent Leges''}}
\newcommand{\bottomcaption}{Inter Arma}
\newcommand{\bottomcontent}{In times of war, the law falls silent.\\ \tikz{\fill[even odd rule] (0,0) circle (0.3) (-0.2,-0.2) rectangle (0.2,0.2);}}
\pgfmathsetmacro{\ruleheight}{0.1}
\newcommand{\stripfontsize}{\Huge}
\newcommand{\captionfontsize}{\LARGE}
\newcommand{\textfontsize}{\large}

\begin{tikzpicture}
{   {\captionfontsize \topcaption}\\
{\textfontsize \topcontent}\\
{\captionfontsize \bottomcaption}\\
{\textfontsize \bottomcontent}\\
};
\end{tikzpicture}

\end{document}


if the rotated symbol is to big you may add some dont size modifier like \large inside the rotatebox before the \ding{n}.

-
+1 for Latin!!11 Feature request: Actually I want to upvote twice. But: Why “Legis”? Is there a philologic edition of Cicero with that reading? Cf. en.wikipedia.org/wiki/Inter_arma_enim_silent_leges – Speravir Mar 14 '12 at 0:56
No, that's just a spelling mistake. I think I thought about "legislature", so legis felt more natural than leges. – Tom Bombadil Mar 14 '12 at 7:05
@TomBombadil thank you! after tweaking it a bit, my only "problem" now is: how can I rotate the symbol? – Diego Mar 14 '12 at 9:54
@Diego: Go ahead and ask that as a new question. (You can link back to this question.) – doncherry Mar 14 '12 at 12:30
@TomBombadil thank you for adding the rotation! – Diego Mar 14 '12 at 20:54
show 1 more comment

(Just saw Tom's answer, but since I had begun writing, I'm gonna finish anyways.)

This is a) too long to be a comment and b) an answer without code, perhaps you can translate some of what I'm saying into code yourself or look up how to do it.

Thank you for adding the code, this looks pretty good! I hardly know any TikZ, so I can't tell you what to change in your code, but here are some ideas about the layout:

• (Not layout-related, actually) Don't use minimal as a document class. Using article instead will get rid of the warnings for you.
• The real card corners are more rounded, i.e. there's more "cut off".
• The side ratio of your card is off, they need to be higher (something like width 3 to height 4). An easy way to fix this is increasing the height of the colored box.
• The text in the colored box actually is right-aligned and bigger; and it is a sans-serif font, just like the other title-y parts.
• The "Time" above the black bar needs to be bigger.
• The colored box needs to extend all the way to the top, just as far as it goes to the bottom.
• After all, adding more text and perhaps a little image will get you closer to the model.

Generally, it's good to break up your problem into tiny parts like these. Then, you can search for something really specific in our question base or in the manual, and ask about it if you couldn't find anything.

-