I am trying to generate previews using AUCTeX on Emacs GUI in my tex buffer but I get a "stop" sign error everywhere. See example below:

When I click on the stop sign and select "View Error" I get the following error message

/Library/TeX/texbin/rungs -dOutputFile\=\(_region_.prv/tmpUN6xxH/pr1-4.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r101.002x101.133
GS>{<</PermitFileReading[(_region_.pdf)(_region_.prv/tmpUN6xxH/preview.dsc)]>> 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 0.246098 0.246098 0.246098 setrgbcolor clippath fill 0.859388 0.859388 0.796887 setrgbcolor}{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def /GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin/graphicsbeginpage{//graphicsbeginpage exec 0.859388 0.859388 0.796887 3 copy rg RG}bind store end readonly store  (_region_.prv/tmpUN6xxH/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 2677()/SubFileDecode filter cvx exec .preview-ST dup dup 5840 setfileposition 54()/SubFileDecode filter cvx<<>>preview-do
Error: /typecheck in --setfileposition--
Operand stack:
   GS_PDF_ProcSet   GS_PDF_ProcSet   GS_PDF_ProcSet   5946   5946   5946   5894   5894   5894   5840
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:742/1123(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Current file position is 29

Additional information that may help:

  • I use Emacs 26.3 (installed with Homebrew on Mac OS X) and I have installed AUCTeX 12.1.2 through MELPA. I have also installed ghostscript 9.50 with Homebrew.
  • It works fine if I try to compile the TeX file or export the PDF
  • I have looked at similar questions from a couple of years ago and it sounds like this was a bug in ghostscript. From reading this question, it sounds like a fix has been added to ghostscript but I still have the error (Can not generate Preview by AUCTeX)
  • I have also read about modifying the Preview GS Options but it didn't work either.
  • Welcome to TeX - LaTeX! – Andrew Swann Oct 31 '19 at 9:01
  • Can you please update your AUCTeX to 12.2.0 via ELPA and try it again? – Arash Esbati Nov 1 '19 at 12:08
  • @ArashEsbati well it turns out it was as simple as that... Looks like it's working fine now, hadn't spotted I hadn't the last version of AUCTeX. I feel a bit silly now! Thanks anyway – wissam124 Nov 1 '19 at 16:16

Preview-LaTeX relies heavily on Ghostscript. Ghostscript went through some bigger changes lately and Preview-LaTeX now follows these changes with the latest release 12.2. Currently, the best combination is to update Ghostscript to 9.50 and AUCTeX to 12.2. The version from ELPA is numbered 12.2.0.

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.