[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-devel] Asking help for preview-latex

From: Ikumi Keita
Subject: [AUCTeX-devel] Asking help for preview-latex
Date: Wed, 19 Jun 2019 14:52:24 +0900

[ I'm sorry if you receive this message twice.  I'm afraid that the
previous one didn't make its way into gs-devel ML, possibly because it
was classified as a spam and discarded.  I'm resending this again,
stripping off the "https://"s from URLs in the text and turning the
quoted error message into an attachment file in a hope that the spam
likeliness is lowered. ]

Dear Ghostscript developers,

I'd like to ask you for help to restore functionality of preview-latex,
which uses Ghostscript to show math formulae images in Emacs buffer of
LaTeX documents.  I'm one of developers of AUCTeX, which has
preview-latex as its subsystem: .

Let me begin with overview of the problem we (AUCTeX developers) want to
address.  It was reported recently that preview-latex does not work
under certain circumstances:
In short, Ghostscript stops with error when preview-latex tries to
adjust the foreground color of the generated image to be the same as
that of Emacs face.

We consider the reason of the problem is that preview-latex relies on
GS_PDF_ProcSet, which was removed in Ghostscript 9.27, from the
following three observations:
(1) Preview-latex works well when the user downgrades to gs-9.26:
(2) Typical error message (attached with this message) tells that
"GS_PDF_ProcSet" caused the error and I found that the official
Ghostscript document[1] says "We eliminated GS_PDF_ProcSet".

(3) The only function which uses GS_PDF_ProcSet in the preview-latex
source is called only when the default face of Emacs has non-trivial
foreground color and preview-latex tries to adjust the foreground color
of the generated image to be the same as that.  In fact, I encounter no
errors even with gs-9.27 when I use preview-latex with standard
foreground color (black) in Emacs.

Assuming the above consideration is correct, we would appreciate if you,
the Ghostscript developers, could kindly provide alternate Postscript
code to achieve the original purpose of preview-latex.  The relevant
elisp code is:
(defun preview-pdf-color-string (colors)
  "Return a string that patches PDF foreground color to work properly."
  ;; Actually, this is rather brutal.  It will only be invoked in
  ;; cases, however, where previously it was not expected that
  ;; anything readable turned up, anyway.
  (let ((fg (aref colors 1)))
    (if fg
         "/GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin\
/graphicsbeginpage{//graphicsbeginpage exec "
         (mapconcat #'preview-gs-color-value fg " ")
         " 3 copy rg RG}bind store end readonly store "))))
.  What we would like to know is the code (string) to replace the
"/GS_PDF_ProcSet GS_PDF_ProcSet dup..." part.  Unfortunately, I don't
understand any Postscript language, but I hope that the above piece of
code together with the error message attached with this message is
enough to determine what to do, even without knowledge of elisp.  Please
note that these codes go through pdf2dsc.

If the given information is not enough, feel free to ask us any
additional materials.

Please keep address@hidden in CC: when replying.

Best regards,
Ikumi Keita

Attachment: error_message
Description: error message

reply via email to

[Prev in Thread] Current Thread [Next in Thread]