I thought that PSTricks package was not possible to use in pdfLaTeX but the user Dima claims otherwise.

How can I force pdfLaTeX to use PSTricks then?

4 Answers 4


The easiest way is running xelatex instead of pdflatex. It detects itself PostScript code or eps images in the document and does the conversion on the fly. If you do not want to use xelatex then there are other solutions:

If you have an up-to-date TeX distribution use


and then run your document with pdflatex -shell-escape <file>. Then the PSTricks images are created on-the-fly as stand alone pdf images and saved in <file>-pics.pdf. If you have an older system use


For more information see PSTricks web page

For Windows you have to install a Perl version, if you want to use the full power of the auto-pst-pdf package. However, if you do not want or cannot install Perl then use


There is also a Perl script pst2pdf which can create the document with pdflatex and also the PSTricks images as pdf|png|whatever images. It takes the preamble of the main document and creates stand-alone-documents for all PostScript specific code.

  • 2
    I see one shortcoming with pstricks and tikz (mentioned several times by other users): this is the fact that we have to compile over and over the same figures when working on a report. With the shell escape, it becomes problematic because the compilation takes longer. Would it be difficult to implement a test so that if the <file>-pics.pdf already exists, latex skips the compilation of the associated pstricks code? Equivalently, it may be more relevant to compile the pstricks figures separately (separate files) and then, input the pic.pdf only in the main file. Any thoughts?
    – pluton
    Commented Jan 6, 2011 at 19:58
  • @pluton: The tricky part is what to do when the code changes. I suppose it'd be possible to do something like get the MD5 hash of the output and the input, put it in the aux file, and then on recompile, if the hash of the input or output do not match the stored one, recompute. One can use the pdfTeX primitive \pdfmdfivesum to compute the hash.
    – TH.
    Commented Jan 6, 2011 at 20:15
  • 5
    @pluton: \usepackage[off]{auto-pst-pdf}
    – user2478
    Commented Jan 6, 2011 at 20:18
  • 6
    @pluton: for TikZ/pgf you can use the externalise library to do this. I've just been using it on a very picture-intensive document (116 separate pictures) and it saved a lot of hanging around waiting for the thing to compile. Commented Jan 6, 2011 at 20:20
  • 1
    run texdoc pst-news10
    – user2478
    Commented Feb 23, 2011 at 17:12

While I was not aware of the solution provided by Herbert, let me also introduce another solution.

You can easily use pstricks with pdflatex following this procedure:

  1. Include the pstricks package in your .tex file (the second is necessary only in case that you want to use the pstricks extensions):


Now, when processing your files to generate the final pdf file go through these steps (in the following it is assumed that main.tex is your main tex file):

  1. Create the dvi file:

    latex main.tex
  2. Create the postscript file:

    dvips -Ppdf -G0 main.dvi
  3. Finally, generate the pdf file:

    ps2pdf main.ps

Fortunately, all these steps can be automated in a makefile (I wish there would be a way to attach a file to these answers but I have found none in the advanced help, sorry about that):

NAME    = myfile.pdf
SRC     = main.tex
OBJ     = main.pdf

# Macro Definitions 
LATEX   = latex
DVIPS   = dvips
PSPDF   = ps2pdf
RM      = /bin/rm -f    
TAR     = tar

.SUFFIXES: .tex .dvi .ps .pdf

    $(LATEX) $<

    $(DVIPS) -Ppdf -G0 $<

    $(PSPDF) $<

# Basic Compile Instructions #

all:    $(NAME)

$(NAME): $(OBJ)
    @mv $(OBJ) $(NAME)

: $(SRC)

    @$(RM) *.aux *.log *.nav *.out *.snm *.toc *.dvi *.bbl *.blg *~

delete: clean
    @$(RM) $(NAME) $(OBJ) *.ps *.tar.gz

    @echo "Type 'make; bibtex main; make; make' to get the pdf file"
    @echo "Type 'make clean' to delete all intermediate files"
    @echo "Type 'make delete' to delete all intermediate and output files"

If you copy and paste this makefile to one of yours make sure to put the tabs at the right locations.

An advantage of this approach is that it works smoothly, just typing make after editing your LaTeX files will make all the hard work for you with no other intermediate steps for you to take care of. If you have to process bib references then type: make, then bibtex and make again.

  • that are the steps which nearly all GUIs are able to do by default.
    – user2478
    Commented Aug 18, 2011 at 11:13
  • 5
    Certainly, but users using emacs (such as me) and a linux/mac os terminal might hopefully find it useful. Commented Aug 18, 2011 at 15:24
  • How about if you are not using a command line or for that much linux at all?
    – night owl
    Commented Dec 11, 2011 at 8:07
  • I use winedt 7/8. But i don´t know i have to do for make (LATEX + DVI + PS + PDF). I don´t see that option in WinEdt. I don´t know where y must COPY & PASTE the previous text of Carlos Linares.
    – Mika Ike
    Commented Jun 9, 2013 at 12:41
  • 4
    This isn't a way of using pdfLaTeX. It avoids the use of pdfLaTeX instead.
    – cfr
    Commented Sep 11, 2016 at 19:02

Just another way:

% TeX it with pdflatex -shell-escape filename
% filename.tex


%====== begin file contents ======
%====== end file contents ======

{% if exist do nothing
 % file age should be taken under consideration but it is ignored for simplicity!
{% if not exist do the following
  \immediate\write18{latex circle && dvips circle && ps2pdf -dNOSAFER -dAutoRotatePages=/None circle.ps}%

\caption{Red Circle}
  • Make sure you compile it with pdflatex --shell-escape filename.tex as I already mentioned at the first comment in the given code. Commented Mar 10, 2013 at 14:15

For completeness, there is a script ps4pdf that runs following commands to convert a .tex file that uses PSTricks into PDF.

latex $1.tex
dvips -Ppdf -o $1-pics.ps $1.dvi
ps2pdf $1-pics.ps $1-pics.pdf
pdflatex $1.tex
bibtex $1
pdflatex $1.tex

You must log in to answer this question.

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