Re: [AUCTeX-devel] Asking help for preview-latex

Ikumi Keita <[email protected]> Fri, 12 Jul 2019 17:33:14 +0900
Newsgroups gmane.comp.printing.ghostscript.devel,gmane.emacs.auctex.devel
Message-ID <23379.1562920394@localhost>
>>>>> David Kastrup <[email protected]> writes:
> I don't think that the drawback is necessary: in contrast to a working
> DELAYBIND, it is easy to test for existence of the PDF dictionary at
> runtime and use it if available.

> The test would be something like

> /GS_PDF_ProcSet where { pop [put old code here] } if

Do you mean that the patch listed below should work?  But it fails for
me, at least for gs 9.27 with patches which Chris indicated.  The "do
not enter" sign appears in the Emacs buffer and the math formulae are
not replaced with images for the following document "tst-prv.tex" when
the Emacs theme is "deeper-blue".  I quote the two errors at the last of
this message.

The errors persist even if I change the line
"/GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin\
to
"GS_PDF_ProcSet dup maxlength dict copy dup begin\
or
"dup maxlength dict copy dup begin\
.

Regards,
Ikumi Keita

----- tst-prv.tex --------------------------------------------------
\documentclass{article}

\begin{document}
\begin{equation}
  1+1=3D2
\end{equation}

\(x^{2}+y^{2}=3Dz^{2}\)

\end{document}
---------------------------------------------------------------------

----- patch for master branch of git repo ---------------------------
diff --git a/preview.el.in b/preview.el.in
index 30bf45bf..49f1d133 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -750,10 +750,12 @@ to Ghostscript floats."
   (let ((fg (aref colors 1)))
     (if fg
 	(concat
+	 "/GS_PDF_ProcSet where { pop [ "
 	 "/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 "))))
+	 " 3 copy rg RG}bind store end readonly store "
+	 "] } if "))))
 =

 (defun preview-gs-color-string (colors)
   "Return a string setting up colors"

----------------------------------------------------------------------

----- errors ---------------------------------------------------------
/usr/local/texlive/2019/bin/amd64-freebsd/rungs -dOutputFile\=3D\(tst-prv.=
prv/tmpfUQPAL/pr1-2.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinte=
d -dTextAlphaBits\=3D4 -dGraphicsAlphaBits\=3D4 -sDEVICE\=3Dpng16m -r108.6=
06x108.587
GS>{<</PermitFileReading[(tst-prv.pdf)(tst-prv.prv/tmpfUQPAL/preview.dsc)]=
>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped po=
p/.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.0937514 0.101564 0.14844 setrgbcolor clippath fill 0.=
8 0.8 0.8 setrgbcolor}{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/previe=
w-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}bi=
nd def /GS_PDF_ProcSet where { pop [ /GS_PDF_ProcSet GS_PDF_ProcSet dup ma=
xlength dict copy dup begin/graphicsbeginpage{//graphicsbeginpage exec 0.8=
 0.8 0.8 3 copy rg RG}bind store end readonly store ] } if  (tst-prv.prv/t=
mpfUQPAL/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfilepositio=
n 460()/SubFileDecode filter cvx exec .preview-ST dup dup 460 setfileposit=
ion 53()/SubFileDecode filter cvx<<>>preview-do
Error: /typecheck in --setfileposition--
Operand stack:
   false   false   false   460
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostri=
ngval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_co=
ntinue   --nostringval--   --nostringval--   false   1   %stopped_push   .=
runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stop=
ped_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 28
GS<4>

/usr/local/texlive/2019/bin/amd64-freebsd/rungs -dOutputFile\=3D\(tst-prv.=
prv/tmpfUQPAL/pr1-1.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinte=
d -dTextAlphaBits\=3D4 -dGraphicsAlphaBits\=3D4 -sDEVICE\=3Dpng16m -r108.6=
06x108.587
GS>{<</PermitFileReading[(tst-prv.pdf)(tst-prv.prv/tmpfUQPAL/preview.dsc)]=
>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped po=
p/.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.0937514 0.101564 0.14844 setrgbcolor clippath fill 0.=
8 0.8 0.8 setrgbcolor}{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/previe=
w-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}bi=
nd def /GS_PDF_ProcSet where { pop [ /GS_PDF_ProcSet GS_PDF_ProcSet dup ma=
xlength dict copy dup begin/graphicsbeginpage{//graphicsbeginpage exec 0.8=
 0.8 0.8 3 copy rg RG}bind store end readonly store ] } if  (tst-prv.prv/t=
mpfUQPAL/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfilepositio=
n 460()/SubFileDecode filter cvx exec .preview-ST dup dup 513 setfileposit=
ion 52()/SubFileDecode filter cvx<<>>preview-do
Error: /undefined in graphicsbeginpage
Operand stack:
   false
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostri=
ngval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_co=
ntinue   --nostringval--   --nostringval--   false   1   %stopped_push   .=
runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stop=
ped_push
Dictionary stack:
   --dict:739/1123(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GS<1>
----------------------------------------------------------------------