Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.
<recently read> \c@lor@to@ps 

l.6     \psdots(
             0,0)(2,0)(1,1)
? 
share|improve this question

migrated from stackoverflow.com Mar 15 '12 at 20:34

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

marked as duplicate by N.N., doncherry, Joseph Wright Mar 18 '12 at 9:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
run the document with xelatex and look also at tug.org/PSTricks/main.cgi?file=pdf/pdfoutput –  Herbert Mar 15 '12 at 20:56
    
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Mar 15 '12 at 21:02

1 Answer 1

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.

share|improve this answer