3

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).

Steve
  • 135
  • 1
  • 7

2 Answers2

3

Viewing this answer may help you.

To keep this answer short.

  • 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.

    texmaker preferences tab

    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.

n_dimos
  • 56
2

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

enter image description here