I use a lot of PSTricks-based graphics. Since graphics generation takes an awful long compilation time over XeLaTeX, I resort to pdfLaTeX first using the auto-pst-pdf package. On a later run, meaning, once the graphics have been generated, I can use the off option so as to use the already-existing pdf file issued by auto-pst-pdf, but this works only over pdfLaTeX. I've tried with the \savepicture and \usepicture commands over XeLaTeX, but I don't get the graphics.

My question goes thus: What would be a "good" approach to using the auto-pst-pdf-generated file with the graphics in an automated way when compiling over XeLaTeX in order to have this automated? I know I could split the auto-pst-pdf-generated file and save the graphics on a separate basis, but I'm asking about a more efficient approach in terms of "manual tweaking."


One would have to rewrite pst-pdf and auto-pst-pdf to make them usable with xelatex as they assume a lot regarding the compilation method with latex/dvips to create the images, and you can't use latex/dvips with a normal xelatex document as it can't handle the fonts.

But you can use the externalize library of tikz/pgf:

\tikzset{external/system call={xelatex --jobname="\image" 

%\tikzset{external/force remake} %uncomment if the images should be remade

  • @{Ulrike Fischer, Herbert}: Both answers are useful and valuable. The reason why I'm selecting Ulrike's is only that I think it fits better my question in that it doesn't require that I call any script, and it can be entirely embedded in my LaTeX code (even though I understand that with arara this can be said also about Herbert's answer). I'm sure I'll be using frequently any one of the two answers. – Marcos Jan 13 '14 at 21:37

It makes no sense to use auto-pst-pdf with xelatex. xelatex always takes the route xdvi->xdvipdfmx with or without auto-pst-pdf. And, of course, auto-pst-pdf itself cannot handle xelatex.

As an alternative use the script pst2pdf which is part of TeXLive and MikTeX:

pst2pdf <file.tex> -x

( -x is for xetex) Or without creating new images

pst2pdf <file.tex> -x --noImages

<file>-pst.tex|pdf is the TeX|PDF file which holds all images on single pages. And <file>-pdf.tex|pdf ist the TeX/PDF file which uses \includegraphics instead of the pspicture environments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.