pstricks compile problem

I know this issue has been discussed a lot in other topics, but most of them contain complex examples, from which I haven't been able to understand the solution. So I have the following code:

 \documentclass{article}
\usepackage[pdf]{pstricks}
%\usepackage[usenames,dvipsnames]{pstricks}

\begin{document}
\begin{pspicture}(0,-0.8)(2.0,0.8)
\psline[linewidth=0.04cm](0.0,0.78)(1.98,-0.78) \end{pspicture}
\end{document}


I keep getting the error message: Undefined control sequence. What am I doing wrong? (I'm using texmaker in ubuntu).

-
Are you using pdflatex or latex-dvips-ps2pdf or xelatex? –  stalking isn't tolerated Nov 4 '13 at 21:06
I'm using pdflatex –  Steve Nov 4 '13 at 21:09
Did you compile it with pdflatex -shell-escape inputfilename.tex? –  stalking isn't tolerated Nov 4 '13 at 21:09
@Marienplatz It seems that the obtained line is the line of OP's activity. ;-) –  Przemysław Scherwentke Nov 4 '13 at 21:33
I compiled it through texmaker with pdflatex, don't know how to use -shell-escape in that. –  Steve Nov 4 '13 at 22:20

• You can either use xelatex instead of pdflatex. In this case you should remove the [pdf] option from the pstricks package.
• Or you can use pdflatex with the modification proposed in a previous comment or the afforementioned link. To do that you should go to the tab shown in the image.

On this tab you should modify the command for pdfLatex from pdflatex -interaction=nonstopmode %.tex to pdflatex -interaction=nonstopmode -shell-escape %.tex.

My understanding is that this will create some PDF files with the images. I don't know if they are automatically being merged to the rest of the document though.

If you don't really need pdflatex for a spefic reason, other than pstricks, then I would suggest changing to xelatex. In my opinion it provides a "cleaner" approach to the matter.

I hope this helps.

-

insert the option --shell-escape into your configuration for pdflatex/latex/xelatex:

-