[Tex/LaTex] Convert PSTricks to TikZ

pstrickstikz-pgf

I use pstricks for all my graphics. Now I am submitting a paper to a conference which, unfortunately, does not allow to use PostScript. I have to send them tex source, which they compile with pdflatex. So, pstricks might not work (I am almost sure they won't apply the solutions here: How to use PSTricks in pdfLaTeX?).

The only solution I found was to convert PStricks to TikZ. Is there an automatic converter for this task?

Best Answer

Quoted from my comment here (click):

If PDF images are allowed to be included together with your main TeX source file (aka input file), then you can generate a PDF for each PSTricks diagram using standalone document class (to get a tight image without white borders) compiled with latex-dvips-ps2pdf (for faster compilation).

To be more explicit:

  • Go to each diagram in your main input file.
  • Cut each a pair of \begin{pspicture} and \end{pspicture}.
  • Paste in a new document called fig1.tex and saved in a sub directory Images, having the following structure:

    % fig1.tex
    \documentclass[pstricks,border=12pt]{standalone}% remove the border key if you want a tight output without any border.
    \begin{document}
    \begin{pspicture}(35,20)
    ...
    \end{pspicture}
    \end{document}
    
  • Compile fig1.tex with either latex-dvips-ps2pdf (which is much faster) or xelatex (which is much slower). Here, using pdflatex -shell-escape does not make sense for creating tight standalone diagrams.

  • Check the newly created file fig1.pdf in Images sub directory.
  • In your main document, put

    \usepackage{graphicx}
    \graphicspath{{Images/}}
    

    in the preamble and for each diagram you want to import, do the following.

    \begin{figure}
    \centering
    \includegraphics{fig1.pdf}
    \caption{any caption}
    \label{anylabel}
    \end{figure}
    
  • Remove \usepackage[pdf]{pstricks} from your main input file.

  • Compile the main input file with pdflatex to get a PDF output.
  • Done.
Related Question