auctex-devel
[Top][All Lists]
Advanced

[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: Thu, 20 Jun 2019 18:47:12 +0900

[ I'm sorry if you receive this message multiple times.  The previous
ones were discarded by gs-devel ML since I didn't subscribe.  Now I'm
subscribed and resending this again. ]

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: httsp://www.gnu.org/software/auctex/ .

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:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35571
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35696
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36039
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:
https://lists.gnu.org/archive/html/bug-auctex/2019-05/msg00034.html
(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".

[1] https://www.ghostscript.com/doc/9.27/History9.htm
(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
        (concat
         "/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]