I recently went back to using preview LaTeX (previously used a while back when it was standalone and not part of AucTeX)...but see the following Postscript error when clicking on stop sign:

c\:/Users/x.y/MikTeX/miktex/bin/x64/rungs.exe -sOutputFile\=_region_.prv/tmpQCdxfw/pr1-3.png -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r131.186x131.284 -dDELAYBIND
GS>systemdict /.addcontrolpath known {/PermitFileReading (_region_.pdf) .addcontrolpath
/PermitFileReading (_region_.prv/tmpQCdxfw/preview.dsc) .addcontrolpath} if
{<</PermitFileReading[(_region_.pdf)(_region_.prv/tmpQCdxfw/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 0 0 setrgbcolor clippath fill 0.917647 0.917647 0.917647 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 /initgraphics {
  /RG where {
    pop 0.917647 0.917647 0.917647 3 copy rg RG
  } if
} bind def .bindnow  (_region_.prv/tmpQCdxfw/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 506()/SubFileDecode filter cvx exec .preview-ST dup dup 506 setfileposition 52()/SubFileDecode filter cvx<<>>preview-do
Error: /stackunderflow in --dup--
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--
Dictionary stack:
   --dict:1242/1684(ro)(G)--   --dict:0/20(G)--   --dict:82/200(L)--
Current allocation mode is local
Current file position is 4

The error is very similar to reported issues here AUCTeX fails to generate previews and here Can not generate Preview by AUCTeX though the exact Postscript error reported by Ghostscript is different, both of which have been successfully resolved.

The other telltale in Emacs messages buffer: Cannot find image file ‘u:/test/_region_.prv/tmpQCdxfw/pr1-1.png’ [39 times] since this subfolder contains only the preview.dsc but no .png files.

I'm on Windows 10 running Emacs v26.3 with MikTeX 20.6, AucTeX 12.2.4 and Ghostscript 9.52. Compiling latex file into pdf works fine. Running preview-latex successfully creates _region_.pdf in the working folder with the equation/image snippets.


8/8 edit: minimal .tex file:


  1 + 2 = 3

  1 = 3 - 2

  1 + 2 &= 3\\
  1 &= 3 - 2


Additional observation that two equation latex commands create the stop sign which shows postscript error described above while the align latex command creates an empty rectangle which reports missing .png file error also described above.


Any suggestions are greatly appreciated since I've spent several hours researching this error with no particular insight and no knowledge how to debug Postscript.

  • 2
    Welcome to TeX.SE! – Mensch Aug 5 '20 at 19:00
  • Can you provide a small .tex file exhibiting the issue you describe? – Arash Esbati Aug 7 '20 at 21:54
  • 1
    original post edited per your comment. thanks! – ash Aug 8 '20 at 20:20
  • Thanks for the example. Works for me without problems. I suspect this is an issue with MikTeX. Do you have a chance to install TeXlive? This is the system I use. – Arash Esbati Aug 9 '20 at 9:20
  • You're correct. After installing TeXlive (which took a while) and voila, previews work! Thanks again. – ash Aug 9 '20 at 18:28

Your Answer

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

Browse other questions tagged or ask your own question.