# Getting pst-poker to work

I need help with the pst-poker package included in texlive. I verified that everything is installed, but if I try to run

\documentclass{article}
\usepackage{pst-poker}
\begin{document}
\As
\end{document}


I get the "Undefined control sequence. \As" error.

Note that if I try to load the package using "\usepackage{poker2}" as instructed in the documentation, it tells me "File poker2.sty' not found. \begin". I guess the name of the package has simply changed and the documentation hasn't been updated.

Now, if I make it run despite the error, I get this messed up output:

so clearly the package exists and is detected, but there's a weird bug.

Edit: Alright, compiling with latex/dvips/ps2pdf works. xelatex works as well, and also seems to work with documents that give me errors with latex in dvi mode, and even works through latexmk!

• Welcome to TeX.SE! Your MWE runs through without any problem on my TeXLive 2017 installation, which is up-to-date according to my package manager. – user121799 Mar 15 '18 at 2:19
• latexmk isn't smart enough to detect that you need to compile with latex+dvips instead of pdflatex. So you need to tell TeX Studio to compile it that way. – Alan Munn Mar 15 '18 at 2:51
• You also can compile with pdflatex if add \usepackage{auto-pst-pdf} (after pstricks) and add the option --enable-write18 to pdflatex switches if you're under MiKTeX, or -shell-escape for TeX Live or MacTeX. – Bernard Mar 15 '18 at 10:47
• @Bernard it indeed runs, but if I use latexmk and pass --shell-escape, it keeps making passes and tells me the file is not stable. – Alexbib Mar 16 '18 at 16:55
• Ah! I didn't know that. As I dont use latexmk, I have no idea whether it is a configuration problem? – Bernard Mar 16 '18 at 16:57

Compile with latex-dvips-ps2pdf sequence or xelatex.

## Example 1

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-poker}
\begin{document}
\crdAs
\end{document}


## Example 2

\documentclass[pstricks,border=12pt]{article}
\usepackage{pst-poker}
\begin{document}
\Ah
\Ac
\As
\crdAh
\crdAc
\crdAs
\end{document}


• It might be helpful to explain the source of the error, for the OP, since the problem is not with the MWE provided, so new examples will yield the same error if not compiled with the right engine. – Alan Munn Mar 15 '18 at 2:53
• Alright, compiling with latex/dvips/ps2pdf works. xelatex runs forever without returning any output... Unfortunately, a bunch of other documents I work with won't compile when trying to generate a dvi (I get a bunch of "not allowed in DVI mode"), so I'm stuck if I try to add a poker card on those documents... – Alexbib Mar 15 '18 at 3:19
• @Alexbib: there should be no problem with xelatex. Does it hang with your original example? – user2478 Mar 16 '18 at 16:03
• @Herbert I was mistaken, lualatex is the one that hangs, xelatex runs properly. – Alexbib Mar 16 '18 at 16:56
• For lualatex you need package auto-pst-pdf-lua – user2478 Mar 18 '18 at 18:29

Using lualatex --shell-escape <file>:

\documentclass{article}
\usepackage{pst-poker}
\usepackage{auto-pst-pdf-lua}

\begin{document}
\begin{postscript}
\As \crdAs
\end{postscript}
\end{document}
`

Package auto-pst-pdf-lua