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 copied the solution from this link to a file try.tex under Emacs:

\documentclass{article}

\usepackage{pst-tree}

\begin{document}
Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem ipsum. Lorem
ipsum. 

\begin{figure}
   \centering
   \begin{pspicture}(5,-5)
   \psgrid
   \pstree{\Tcircle{ }}
         {
           \pstree{\Tr{ }}{\Tfan}
           \pstree{\Tr{ }}{\Tfan}
         }
   \end{pspicture}
   \caption{}
\end{figure}

Lorem ipsum. Lorem ipsum. Lorem ipsum. 

\end{document}

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?

share|improve this question
    
That doesn't look like an Emacs problem, I think the problem is in the pst-tree macros. –  Tyler Feb 28 '13 at 22:04
    
This appears to be a duplicate of the question in the related list that come up automatically: tex.stackexchange.com/questions/10549/… –  David Carlisle Feb 28 '13 at 22:07
add comment

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
+1 for bringing it back to the question:-) –  David Carlisle Feb 28 '13 at 22:33
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
add comment

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.

share|improve this answer
add comment

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.