The auctex in emacs has worked well before, but recently whenever I run a preview command such as C-c C-p C-b, it shows "Preview-Ghostscript finished at XXX" without any error notice in the log, but none of the formulas in the latex is actually replaced by pictures, instead only a additional red dot with a white minus symbol is placed alongside the original text, implying something is missing.

I suspect that some temporary files of ghostscript are deleted, because if I run the preview command again without editing anything in the latex file, the log output will complain that it cannot find the file " preview.dsc ", and all formulas in latex are replaced by a picture of red triangle.

In short, the first time no error notification and no pictures; the second time the error notification and the error pictures.

My auctex is already the latest version 12.1.2, and the emacs is 47.0. The commands of compiling of latex files work well both inside and outside of emacs,

and the last part of the complaining log is:

Transcript written on _region_.log.

TeX Output exited as expected with code 1 at Fri May 10 21:24:25
Running `Preview-PDF2DSC' with ``pdf2dsc _region_.pdf _region_.prv/tmp320808Zw/''
Error: /undefinedfilename in --file--
Operand stack:
   PDFfile   (_region_.pdf)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   2045   1   3   %oparray_pop   2044   1   3   %oparray_pop   2025   1   3   %oparray_pop   1884   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:973/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 1814
GPL Ghostscript 9.26: Unrecoverable error, exit code 1

Preview-PDF2DSC exited abnormally with code 1 at Fri May 10 21:24:26
PDF2DSC sentinel: Opening input file: No such file or directory, /home/myhome/new/paper/_region_.prv/tmp320808Zw/preview.dsc

PS: I have tried to remove the ~/.eamcs.d and reinstall all packages but the problem remains.

PS: Yes! when the first preview command finished there did exist a "_region_.pdf" file and every formula was correctly generated inside, but somehow they didn't show up in the emacs document; and after the second preview command the "_region_.pdf" disappeared, and I got the "no such file" log.

In the log of the first preview command, I didn't see any really error notification at "region.log", and the last part of the log is:


l.40 $\frac{1}{\sqrt{2\pi}\sigma}$

Not a real error.

./_region_.tex:42: Preview: Snippet 3 started.

l.42 \begin{equation}

Not a real error.

./_region_.tex:44: Preview: Snippet 3 ended.(813539+0x23592960).

l.44 \end{equation}

Not a real error.

Package atveryend Info: Empty hook `BeforeClearDocument' on input line 47.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 47.
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 47.
Package atveryend Info: Empty hook `AtEndAfterFileList' on input line 47.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 47.
Here is how much of TeX's memory you used:
 759 strings out of 485787
 11940 string characters out of 6037801
 185847 words of memory out of 5000000
 11362 multiletter control sequences out of 15000+600000
 18662 words of font info for 54 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 30i,6n,26p,399b,325s stack positions out of 5000i,500n,10000p,200000b,80000s
Output written on _region_.pdf (3 pages, 59524 bytes).
PDF statistics:
 48 PDF objects out of 1000 (max. 8388607)
 35 compressed objects within 1 object stream
 2 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

So why doesn't Emacs show up the pictures in the first time and deletes the correct pdf file in the second time?

And the ghostscript in my Ubuntu 18.04 is 9.26. Could this be the Problem?

  • The file /home/myhome/new/paper/_region_.pdf is missing. It should be generated by AucTeX via pdflatex. If there is a log-file /home/myhome/new/paper/_region_.log you should have a look therein. It should reveal the error. – Tobias May 10 '19 at 17:18
  • The first time the "region.pdf" was generated conenctly but didn't show up, and the second time that file was somehow deleted and Emacs complained "no such file". The log is pasted inside the question. – Lh Guo May 11 '19 at 4:40
  • I have the same problem (no error on the first run, error on the second run, red circle with white bar at center). Ghostscript 9.27 causes problem. I install old version Ghostscript 9.19 64bit and preview works fine. – trung Jul 23 '19 at 20:08

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.