[pstricks] Is pst-pdf meant to work with arbitrary postscript

Gene Selkov selkovjr at gmail.com
Wed Sep 16 06:18:35 CEST 2009


Greetings to all PSTricksters out there,

I have just stumbled on this line:

  "The package pst-pdf simplifies the use of graphics from PSTricks
and other PostScript code in PDF documents"

and decided to give pst-pdf a try, assuming that "other PostScript"
would mean "any other". I'm seeing variable degrees of success.

To start from afar: I am putting together a book with docbook/DSSSL,
dbtexmath and ochem. It builds fine as postscript, but it would be
nice to render it as PDF as well (I am trying to use pdfjadetex for
that), because conversions from postscript are too inaccurate. Also,
testing cross-references in postscript is not easy.

The problem at hand: pst-pdf creates broken postscript out of
postscript special. I know nothing about postscript and I don't know
how broken it is. I get this message when I try to view it in evince
(which I believe has a way of calling gs):

undefined -21

and when I call gs directly, the message is:

Error: /undefined in b12
Operand stack:
   30.0   0.0   0.0   18.0   90.0   15.59   9.0   12.0   40.0   15.59
 9.0   6.0
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--
--nostringval--   --nostringval--   false   1   %stopped_push   1862
1   3   %oparray_pop   1861   1   3   %oparray_pop   1845   1   3
%oparray_pop   1739   1   3   %oparray_pop   --nostringval--
%errorexec_pop   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1147/1684(ro)(G)--   --dict:1/20(G)--   --dict:76/200(L)--
--dict:178/300(L)--   --dict:53/200(L)--
Current allocation mode is local
Last OS error: 11
Current file position is 1047049
GPL Ghostscript 8.64: Unrecoverable error, exit code 1


The bit that causes this error looks like this:

{\unitlength1bp\begin{pspicture}(  74.95,  27.94)
{\chemfontname
\special{\string"
%initialization section
0.500000 setlinewidth /lw 0.500000 def
/bw 2.500000 def
/bd 1.000000 def
/aw 5.000000 def
%formula
30.00 0.00 0.00 18.00 b0
90.00 15.59 9.00 12.00 b0
40.00 15.59 9.00 6.00 b12
-30.00 15.59 9.00 18.00 b0
30.00 31.18 0.00 18.00 b0
} % end of special
\put(-1.000000,-1.000000){\textcolor{white}{\rule{0.010000pt}{0.010000pt}}}
\put(75.952932,28.942750){\textcolor{white}{\rule{0.010000pt}{0.010000pt}}}
\put(11.908802,21.000000){\textcolor{white}{\rule{7.359310pt}{6.942750pt}}}
\put(11.908802,21.000000){O}
\put(17.685334,9.567841){\textcolor{white}{\rule{4.998780pt}{6.577770pt}}}
\put(17.685334,9.567841){3}
\put(46.765372,5.528625){\textcolor{white}{\rule{28.187560pt}{6.942750pt}}}
\put(46.765372,5.528625){COOH}
}\end{pspicture}}%s

I see "b12" in there -- is it a co-incidence, or is it the element
that breaks it? If I replace it with "b0", the figure gets rendered
without crashing, but then it has nothing but text in it.

For comparison, the following picture is rendered entirely correctly,
although it is not as interesting:

{\unitlength1bp\begin{pspicture}(  24.65,   8.44)
{\chemfontname
\special{\string"
%initialization section
0.500000 setlinewidth /lw 0.500000 def
/bw 2.500000 def
/bd 1.000000 def
/aw 5.000000 def
%formula
0.00 0.00 4.97 6.00 b0
} % end of special
\put(-1.000000,-1.000000){\textcolor{white}{\rule{0.010000pt}{0.010000pt}}}
\put(25.649340,9.442730){\textcolor{white}{\rule{0.010000pt}{0.010000pt}}}
\put(6.000000,0.000000){\textcolor{white}{\rule{18.649340pt}{8.442730pt}}}
\put(6.000000,1.499980){NH$_2$}
}\end{pspicture}}%s

I see no problems at all when the same pictures that result in broken
postscript when parsed from a picture environment are instead
rendered into external eps files and then referenced from the latex
source. But that's not a tenable approach to pictures in this book;
there are multiple thousands of them, and I can only manage them
inline, or I won't pull it off.

I'll appreciate any hints for how to debug this.

Thanks,

--Gene


More information about the PSTricks mailing list