# Is there a simple way to typeset playing cards?

I'm writing some probability lectures and would like to typeset some playing cards.

I'm aware of the poker and pst-poker packages, but can't get them to work. Is there a less sophisticated way to typeset playing cards?

• Possibly the fact that it does not work is related to your choice of compiler. E.g. pdflatex may not work without further ado for PStricks based packages.
– user194703
Oct 30, 2019 at 2:53
• I'm sure it's possible, but I'd like a solution compatible with my current latex setup. Oct 30, 2019 at 2:54
• Well, yes, but how would anyone know what your current latex setup is?
– user194703
Oct 30, 2019 at 2:55
• What I mean is, I'm curious if there are other solutions. Whether those other solutions work with my setup will be my problem. Oct 30, 2019 at 2:58
• Possible duplicate: How to draw the cards of a deck?. Oct 30, 2019 at 9:42

EDITED to flip-the-pip in the lower right of the card (hat tip Aofl), and to add a club (flower) suit example:

\documentclass{article}
\usepackage{tabstackengine,xcolor,rotating}
\newcommand\blackcard[2]{%
\begingroup\fboxsep=0pt\relax
\fbox{\tabbedCenterstack{%
\scriptsize$#2$ && \\&\makebox[10pt]{#1}&\\&
&\rotatebox[origin=c]{180}{\scriptsize$#2$}}}%
\endgroup}
\newcommand\redcard[2]{%
\begingroup\fboxsep=0pt\relax
\fbox{\color{red}\tabbedCenterstack{%
\scriptsize$#2$ && \\&\makebox[10pt]{#1}&\\&&\rotatebox[origin=c]{180}{\scriptsize$#2$}}}%
\endgroup}
\begin{document}
\redcard{10}{\heartsuit}
\blackcard{8}{\clubsuit}
\redcard{A}{\diamondsuit}
\end{document}


I thank corporal for stepping in, in my absence, to help with some of the OP's follow-up questions (HOOAH!). Here, I employ his suggestions, though making some small changes, to account for different glyph widths among the packages.

The Joker I provide gratis.

\documentclass{article}
\usepackage{tabstackengine,xcolor,txfonts,fancybox,arev,graphicx}
\cornersize{.1}
\newcommand\blackcard[2]{%
\begingroup\fboxsep=0pt\relax
\Ovalbox{\tabbedCenterstack{%
\makebox[0pt][l]{\scriptsize$#2$} && \\
&\makebox[22pt]{#1}&\\
&&\makebox[0pt][r]{\rotatebox[origin=c]{180}{\scriptsize$#2$}}}}%
\endgroup}
\newcommand\redcard[2]{%
\begingroup\fboxsep=0pt\relax
\Ovalbox{\color{red}\tabbedCenterstack{%
\makebox[0pt][l]{\scriptsize$#2$} && \\
&\makebox[22pt]{#1}&\\
&&\makebox[0pt][r]{\rotatebox[origin=c]{180}{\scriptsize$#2$}}}}%
\endgroup}
\newcommand\jokerface{\raisebox{-2pt}{\kern-1pt\stackengine{0pt}{%
\stackinset{c}{1pt}{c}{-.4pt}{\stackunder[.7pt]{$\cdot\kern2pt\cdot\kern0.3pt$}%
{--}}{$\bigcirc$}}{\,$\steaming$}{O}{c}{F}{F}{S}}}
\newcommand\joker{\vcenter{\hbox{\scalebox{.4}{ \tiny JOKER }}}}
\begin{document}
\redcard{10}{\varheartsuit}
\redcard{A}{\vardiamondsuit}
\blackcard{\jokerface}{\joker}
\end{document}


• Any chance on rounding off the corners to make it 'prettier' Oct 30, 2019 at 4:09
• @3kstc. One way to obtain rounded corners is to use the fancybox package and change \fbox to \Ovalbox or \ovalbox, and use \cornersize{0.1}. The \blackcard \def becomes \newcommand\blackcard[2]{% \begingroup\fboxsep=0pt\relax \cornersize{.1}\Ovalbox{\tabbedCenterstack{% \scriptsize$#2$ && \\&\makebox[10pt]{#1}&\\&&\scriptsize$#2$}}% \endgroup} Oct 30, 2019 at 4:35
• And also fill in the heart and diamonds in red to make it consistent with the spades theme. Oct 30, 2019 at 4:37
• Where's the flower card? :-) Oct 30, 2019 at 8:47
• @StevenB.Segletes Sebastiano is referring to "clubs"... They're called fiori, flowers, in Italian. Oct 30, 2019 at 20:01

Run with xelatex:

\documentclass{article}
\usepackage{pst-poker}
\begin{document}
\crdAs \crdtenh \crdsevd \crdsevc \crdQd
\end{document}


or with pdflatex --shell-escape <file>:

\documentclass{article}
\usepackage{pstricks-pdf}
\usepackage{pst-poker}
\begin{document}
\begin{postscript}
\crdAs \crdtenh \crdsevd \crdsevc \crdQd
\end{postscript}
\end{document}