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.

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

share|improve this question
    
Are you using pdflatex or latex-dvips-ps2pdf or xelatex? –  Who is crazy first 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? –  Who is crazy first 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

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer

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

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.