0

I've looked around for resolutions however, could not find any. Indeed the one response that is pointed out, I already tried. I did the following

sudo gedit .emacs

and embedded the code provided by Preview TikZ figure in AUCTeX? into that file. Am I supposed to run another command after I include that into the .emacs file ? So that emacs knows that it has been upgraded ?

I then also took other posts into consideration, such as AucTeX extension for TikZ, but it did not help me.

Am I supposed to simply download the files into the auctex/ folder ? and/or the preview sub-folder ?

The minimum working example that does not preview is

\documentclass{article}
\usepackage{tikz}
\begin{document}
\section{test}
\begin{tikzpicture}
  \draw [fill=orange] (1,1) rectangle (2,2);
\end{tikzpicture}
\end{document}

I then try to preview it using the C-c C-p C-s command but the TikZ picture doesn't show.

I am a newbie by the way. Any advice is appreciated. UPDATE: I now realized that I can click on the icon that appears before \begin{tikzpicture} to view the error which I hereby append.

gs -dOutputFile\=\(_region_.prv/tmp5466eRu/pr1-1.png\) -q -dDELAYSAFER 
-dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 
-sDEVICE\=png16m -r127.763x127.523
GS>{<</PermitFileReading[(_region_.prv/tmp5466eRu/preview.ps)]>> setuserparams 
.locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped pop/.preview-BP 
currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if 
def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne 
or{.preview-BP }{pop}ifelse}bind/PageSize[1 
1]>>setpagedevice/preview->do{[count 3 roll save]3 1 roll dup length 0 eq{pop}>
{setpagedevice}{ifelse .runandhide}stopped{handleerror quit}if aload pop 
restore}bind def [(_region_.prv/tmp5466eRu/preview.ps)(r)file]aload exch dup 0 
setfileposition 25159()/SubFileDecode filter cvx .runandhide aload pop dup dup 
25270 setfileposition 497()/SubFileDecode filter cvx<<>>preview-do
Error: /undefined in pgfo
Operand stack:
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--   
%loop_continue   --nostringval--   --nostringval--   false   1   
%stopped_push   .runexec2   --nostringval--   --nostringval--   
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--   
false   1   %stopped_push   1148   --nostringval--   %end_runandhide   
--nostringval--
Dictionary stack:
   --dict:1169/1684(ro)(G)--   --dict:0/20(G)--   --dict:83/200(L)--   
--dict:106/300(L)--
Current allocation mode is local
Last OS error: 2
Preview-Ghostscript finished

UPDATE UPDATE: I also edited the .emacs file without the sudo command. I also included the following packages but it still does not work

\usepackage[active,float]{preview}

\PreviewEnvironment{tikzpicture}
  • DON'T use sudo to edit your .emacs. 2) After editing your .emacs it's advisable to restart Emacs to be sure every setting will be loaded (actually, often a M-x eval-buffer in the .emacs buffer suffices). 3) I can preview your MWE, I only need to add \PreviewEnvironment{tikzpicture} to the preview-default-preamble variable.
  • – giordano Feb 19 '14 at 13:59
  • I followed your advise. I saved .emacs without the sudo command. Then exit emacs, restart it and tried it with the \PreviewEnviroment{tikzpicture}, but was still not able to do anything. – user46454 Feb 20 '14 at 03:19