I copied the solution from this link to a file try.tex under Emacs:



Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem

   \pstree{\Tcircle{ }}
           \pstree{\Tr{ }}{\Tfan}
           \pstree{\Tr{ }}{\Tfan}

Lorem ipsum. Lorem ipsum. Lorem ipsum. 


Then I try to compile it with C-c C-c which is LaTeX, but it returns to me ERROR: Undefined control sequence. at the place of \pstree. Could anyone tell me how to compile and preview this picture from Emacs?


This is only sort-of an Emacs issue. As David Carlisle points out, you can't compile your example with pdflatex, you need regular latex. The fact that you don't get regular latex by default with Emacs suggests that you've enabled TeX-PDF-mode. You can turn that off again with M-x TeX-PDF-mode, and then compile as usual with C-c C-c.

  • 1
    You can also add a local variables line to your .tex file. Add the following at the top: %-*- mode: latex; TeX-master: t; TeX-engine: latex -*-. Here's the relevant section of the GNU Emacs manual: gnu.org/software/emacs/manual/html_node/emacs/… – kahen Feb 28 '13 at 22:42
  • @kahen: I think TeX-PDF-mode will override the TeX-engine local variable, but I'm not certain. – Tyler Feb 28 '13 at 22:51
  • 1
    @Tyler: Well. Nothing's stopping you from putting TeX-PDF-mode: nil in the variables line as well – kahen Feb 28 '13 at 22:52
  • @kahen: good point! – Tyler Mar 1 '13 at 1:57

This is clearly unrelated to the editor you use. You don't show the exact error you got but I would guess it is

! Undefined control sequence.
<recently read> \c@lor@to@ps 

l.13    \pstree
               {\Tcircle{ }}

which means that you have used pdflatex which doesn't work for pstricks, you need to use latex then dvips then ps2pdf.

This seems to be a duplicate but I'm using answer rather than comment to format the answer, Your example works for me with latex. no need to vote for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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