8

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?

  • 4
    How about including pre-compiled images as part of your submission? – Werner Sep 11 '14 at 17:50
  • 6
    You are thinking too advanced for academia standards. Just compile your figures as pdf, eps whatever and inlcude them as straightforward images. Zip them in a folder and it's good to go. – percusse Sep 11 '14 at 18:04
  • You can create PDF images using the standalone class, for example – cmhughes Sep 11 '14 at 18:17
  • 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). – kiss my armpit Sep 11 '14 at 18:56
  • @Ohmyghost Thanks! This idea was very helpful. Can you make it an answer? – Erel Segal-Halevi Sep 11 '14 at 20:43
10

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.
  • To be honest, I really do what I wrote above in my daily job (not as a ghost). – kiss my armpit Sep 12 '14 at 6:59
  • To avoid many compilations, one can put every environment in the same file and use the option standalone provides to compile each picture in a separated page (each with the correct adjusted size). – Manuel Sep 12 '14 at 12:58
  • @Manuel: It is not recommended as we will waste much time to compile during the development phase. – kiss my armpit Sep 12 '14 at 12:59
  • I understood he has already the images done, so it would be just one compilation, wouldn't it? – Manuel Sep 12 '14 at 13:00
  • @Manuel: I prefer to provide the best practice approach. :-) – kiss my armpit Sep 12 '14 at 13:01

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.