# PSTricks picture not compiling with pdfLaTeX [duplicate]

Possible Duplicate:
How to use PSTricks in pdfLaTeX?

What is wrong with this code:

\documentclass{article}
\usepackage{pstricks}

\begin{document}
\begin{pspicture}(-0.5,0)(2.5,1)
\psdots(0,0)(2,0)(1,1)
\end{pspicture}
\end{document}


I am trying to compile it with pdflatex, and getting following error:

     ! Undefined control sequence.

l.6     \psdots(
0,0)(2,0)(1,1)
?


## migrated from stackoverflow.comMar 15 '12 at 20:34

This question came from our site for professional and enthusiast programmers.

You have to add the option [pdf] to \usepackage{pstricks} for it to work with pdflatex. This would make your code read as follows:

\documentclass{article}
\usepackage[pdf]{pstricks}

\begin{document}
\begin{pspicture}(-0.5,0)(2.5,1)
\psdots(0,0)(2,0)(1,1)
\end{pspicture}
\end{document}


Note that you need to use shell escape with pdflatex for it work. Thus, issue

pdflatex -shell-escape file.tex


to compile.