9

I'm running into a problem when I try to use the LaTeX packages pst-poker and asymptote in the same document. In particular, the face cards produced by pst-poker have the face images displayed in the wrong position. For example:

\documentclass{standalone}

\usepackage{asymptote}
\usepackage{pst-poker}

\begin{document}

\crdKh

\end{document}

produces king of hearts without a face whereas

\documentclass{standalone}

\usepackage{pst-poker}

\begin{document}

\crdKh

\end{document}

produces the expected king of hearts with a face. As far as I can tell commands for numeral cards all produce the correct output. I've tried looking through the .sty files themselves but I haven't had any luck finding potential conflicts. I'm curious if anyone knows what the conflict is, if any, between these packages.

4
  • 1
    How are you compiling? With latex->dvips->ps2pdf it works fine, with xelatex I can reproduce your issue, and with lualatex pst-poker isn't working for me
    – mbert
    Commented Feb 1, 2023 at 20:23
  • I’ve been using xelatex to compile this. I’ll try the latex->dvips->ps2pdf approach. Thanks!
    – Jesse
    Commented Feb 1, 2023 at 21:48
  • 1
    How were you compiling using xelatex? You need a special command line when using pstricks with xelatex. Commented Feb 6, 2023 at 20:10
  • I didn’t know that @HerbSchulz. Thank you for letting me know! Can you point me in the right direction to find out more?
    – Jesse
    Commented Feb 8, 2023 at 19:43

2 Answers 2

4

The problem is that asymptote.sty redefines \Ginclude@eps. The definition in xetex.def is

\def\Ginclude@eps#1{%
  \Gin@log{<#1>}%
  \bgroup
  \ifx\Undefined\Gin@vllx\else\@trim@vporttrue\fi
  \def\@tempa{!}%
  \dimen@\Gin@urx\p@
  \advance\dimen@ -\Gin@llx\p@
  \if@trim@vport
  \advance\dimen@ \Gin@vllx\p@
  \fi
  \edef\Gin@urx{\strip@pt\dimen@}%
  \dimen@\Gin@ury\p@
  \advance\dimen@ -\Gin@lly\p@
  \if@trim@vport
  \advance\dimen@ \Gin@vlly\p@
  \fi
  \edef\Gin@ury{\strip@pt\dimen@}%
  \dimen@\Gin@req@width
  \[email protected]%
  \divide\dimen@\dimen@ii
  \@tempdima\Gin@req@height
  \divide\@tempdima\dimen@ii
    \special{PSfile="#1"\GPT@space
      \if@trim@vport
      llx=\Gin@vllx\GPT@space
      lly=\Gin@vlly\GPT@space
      \fi
      urx=\Gin@urx\GPT@space
      ury=\Gin@ury\GPT@space
      \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\GPT@space\fi
      \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\GPT@space\fi
      \ifGin@clip clip\fi}%
  \egroup}

while the one in asymptote.sty is

\def\Ginclude@eps#1{%
  \message{<#1>}%
  \bgroup
  \def\@tempa{!}%
  \dimen@\Gin@req@width
  \[email protected]\relax
  \divide\dimen@\dimen@ii
  \@tempdima\Gin@req@height
  \divide\@tempdima\dimen@ii
    \special{PSfile=#1\space
      llx=\Gin@llx\space
      lly=\Gin@lly\space
      urx=\Gin@urx\space
      ury=\Gin@ury\space
      \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi
      \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi
      \ifGin@clip clip\fi}%
  \egroup
}

If I restore the correct meaning (for XeTeX), then the run is successful.

\documentclass{standalone}
\usepackage{graphicx}

\makeatletter
\let\Ginclude@eps@orig\Ginclude@eps
\makeatother

\usepackage{asymptote}
\makeatletter
\let\Ginclude@eps\Ginclude@eps@orig
\makeatother

\usepackage{pst-poker}

\begin{document}

\crdKh

\end{document}

In order to avoid warnings from Ghostscript that might be innocuous, but may not, depending on the type of graphics involved, you should compile with

xelatex-unsafe

(it's not really that unsafe).

enter image description here

Another way might be to convert the eps files of pst-poker to PDF. I tried with epstopdf and it works.

1
  • That did the trick all right. Thank you!
    – Jesse
    Commented Feb 13, 2023 at 19:48
2

With recent versions of your TeX Distribution and Ghostscript use the command

 xelatex -output-driver="xdvipdfmx -i dvipdfmx-unsafe.cfg -q -E" -file-line-error -synctex=1 file.tex

to typeset file.tex, which contains pstricks commands. using xelatex.

3
  • Hmm, I get no King in the output.
    – egreg
    Commented Feb 13, 2023 at 16:59
  • Note: I just compiled the file fine just using xelatex with a fully updated TeX Live 2022. Commented Feb 14, 2023 at 21:35
  • So did I and it didn't succeed.
    – egreg
    Commented Feb 14, 2023 at 21:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .