1

I am trying to use preview-latex but, when I generate previews, these are not loaded in Emacs gtk buffer, even though previews are correctly produced in the .pdf output file.

The error produced is the following:

/usr/local/texlive/2019/bin/x86_64-linux/rungs -dOutputFile\=\(main.prv/tmpysAeuO/pr1-23.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r119.04x119.353
GS>{<</PermitFileReading[(main.pdf)(main.prv/tmpysAeuO/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.101961 0.101961 0.101961 setrgbcolor clippath fill 0.929702 0.929702 0.921889 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.929702 0.929702 0.921889 3 copy rg RG}bind store end readonly store  (main.prv/tmpysAeuO/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 22544()/SubFileDecode filter cvx exec .preview-ST dup dup 23313 setfileposition 53()/SubFileDecode filter cvx<<>>preview-do
Error: /typecheck in --setfileposition--
Operand stack:
   GS_PDF_ProcSet   GS_PDF_ProcSet   GS_PDF_ProcSet   24994   24994   24994   24939   24939   24939   25104   25104   25104   24886   24886   24886   24831   24831   24831   24778   24778   24778   24725   24725   24725   24670   24670   24670   24615   24615   24615   24561   24561   24561   24509   24509   24509   24453   24453   24453   24397   24397   24397   24344   24344   24344   24288   24288   24288   24235   24235   24235   24180   24180   24180   24126   24126   24126   24073   24073   24073   23965   23965   23965   23912   23912   23912   23313
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:739/1123(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Current file position is 30
GS<67>

What can I do to get it working?

I am running Emacs 26.1, texlive 2019, and auctex 12.1.2.

1

I have the exact same problem, error message and symptoms on a system running Arch Linux (kernel 5.3.7-arch1-1-ARCH), texlive 2019, Emacs 26.3 (build 1) and auctex 12.1.2. Everything is updated regularly.

I came across this question on Reddit and the author seems to have encountered the same issue. They report that disabling TeX-PDF-mode (either by C-c C-t C-p or via adding (setq TeX-PDF-mode nil) to the configuration) should solve the issue for the MELPA version of auctex.

This is the version which I use so I applied this configuration but the previews were still not functional.

Another solution is documented in the second reply (by user u/Lockywolf). They point out that a confirmed workaround is to download an older release of Ghostscript and use that for generating the previews.

My currently installed version of Ghostscript is 9.50 so I downloaded the older release 9.27 (ghostscript-9.27-linux-x86_64.tgz) from their GitHub releases as instructed on the official website. I extracted the executable and moved it to a convenient place in my home directory (e.g., ~/bin/). Finally, I added the new path to my init.el configuration with (setq preview-gs-command "~/bin/gs-927-linux-x86_64"). After restarting emacs, the previews seem to work as expected.

Please note that I am unaware whether this workaround impacts negatively the system in terms of security, performance or quality of the produced documents.

  • Thanks. Had to use version 9.25 though (I already had gs 9.27). I hope they're going to solve this bug in the next release. – Marco Venuti Oct 27 '19 at 14:29
  • Thanks. I got the same problem... I will wait until next release... – falematte Dec 24 '19 at 8:40

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.