5

I originally posted this question directly on the Auctex mailing list but did not receive a response. I'll hopefully get more luck on the TeX Exchange.

I was recently reminded by this post regarding availability of preview-latex. After pressing C-c C-p C-b, I get small empty boxes next to my equations. That is, the png images aren't displayed correctly. I looked into the temporary directories and the png files are indeed created. They're just not being displayed correctly in emacs. Does anyone know how to fix this?

After getting that to work, I would also like to set the "font" color in the png files to be green since I have a black background in emacs (currently set to white for testing). How could I modify this?

FYI, I am using AucTeX 11.86 with Emacs 23 in Ubuntu 11.04. Also, this error was reproduced with a simple LaTeX file (below), and emacs was started without the init file (loaded AucTeX and preview-latex manually).

foo.tex:

\documentclass{article}
\begin{document}
Let $x=1$.  %%
Then
\[
\lim_{x\rightarrow \infty} x^{x}
\]
is undefined.  %%
\end{document}

UPDATE 9/16/2011: Right clicking on the emtpy box, I get an option for "view error". On one of it, the error is:

gs -dOutputFile\=\(_region_.prv/tmp27138kzR/pr1-16.png\) -q -dSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r105.443x105.424
GS>{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 0 0 0 setrgbcolor clippath fill 1 1 1 setrgbcolor}{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/tmp27138kzR/preview.ps)(r)file]aload exch dup 0 setfileposition 224768()/SubFileDecode filter cvx .runandhide aload pop dup dup 224768 setfileposition 288()/SubFileDecode filter cvx<<>>preview-do
Error: /typecheck in --setfileposition--
Operand stack:
   --nostringval--   (_region_.prv/tmp27138kzR/preview.ps)   (r)   (r)   (r)   226987   226987   226987   226885   226885   226885   226732   226732   226732   226613   226613   226613   226461   226461   226461   226312   226312   226312   226196   226196   226196   226078   226078   226078   225954   225954   225954   225848   225848   225848   225750   225750   225750   225626   225626   225626   225528   225528   225528   225056   225056   225056   224768
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--
Dictionary stack:
   --dict:1163/1684(ro)(G)--   --dict:0/20(G)--   --dict:79/200(L)--
Current allocation mode is local
Current file position is 31
GS<48>

Any thoughts on how to fix this??? Thanks.

3 Answers 3

15

I was having this same problem when I stumbled across this post. I was able to fix it the following way:

Note, I am using Emacs23.3.1, AUCTeX 11.86, Ubuntu 11.10, Gnome3.2.1

Open a .tex file (or make one). I will assume that you are using Emacs23, using an Xwindow (Mine is in Gnome). Go to the menu bar and do:

Preview -> Customize -> Browse Options

In this buffer, do:

Preview GS -> Preview GS options -> [click on the little arrow to show the options] -> del -dSAFER

C-x C-s to save, and reload Emacs. Previews should work now!

4
  • totally fixed my problems. Ubuntu 11.10 x64, Emacs 23.3.1, AUCTeX 11.86.
    – Dang Khoa
    Commented Feb 14, 2012 at 23:58
  • fixed same problem on os x lion with cocoa/gnu emacs 24.1
    – m7d
    Commented Dec 2, 2012 at 4:49
  • Works on Windows 7 too. GNU emacs 24.2
    – LWZ
    Commented Mar 26, 2013 at 7:41
  • Did not fix things for me. Windows 10, GNU Emacs 27.1. The option wasn't even there to delete.
    – Chrisuu
    Commented Sep 14, 2020 at 1:18
2

First, check image-types to see if your emacs has been compiled with support for png files. (Do C-h v image-types to view the variable and it's value.) If 'png is in the list, then do M-: (image-type-available-p 'png) to test if Emacs can actually decode pngs. If that puts a nil in your message line, then it probably cannot load the dynamic library that it needs for png files.

1
  • Thanks for the suggestion. I passed both tests. I've updated my post for the error message. Let me know your thoughts. Commented Sep 17, 2011 at 6:32
0

Upgrade your AUCTeX from cvs repo

http://savannah.gnu.org/cvs/?group=auctex

1
  • Thanks for the suggestion. I did it and still no go. I updated my post with the error content. Let me know your thoughts. Commented Sep 17, 2011 at 6:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .