# [OS X TeX] Random ps2pdf errors

Herbert Schulz herbs at wideopenwest.com
Mon Oct 22 14:45:12 CEST 2012

On Oct 22, 2012, at 5:00 AM, Luis Sequeira <lfsequeira at gmail.com> wrote:

> Hi
>
> Sorry for the OT question, but I am at a loss...
>
> I am writing a largish Calculus text, with lots of pictures. The pictures are done is pstricks, and are \input'ed in to the main text.
> I can handle pstricks just fine, and the pictures are beatiful.
> This does force me to use the latex-dvips-ps2pdf route (for the record, I have tried alternatives, such as xelatex and lualatex with auto-pst-pdf but these cause even more trouble). I also use a few inline pstricks commands (mostly \psbrace to underline important steps).
>
> I have reached a point where a document typesets perfectly, then I add a word or a math environment (without *any* pstricks code in it) and then ps2pdf chokes, giving me a postscript error.
> There is no error in the latex side.
>
> It may be something as absurd as this (somewhere in the middle of the text, in paragraph mode, so I can't produce a complete minimal example):
>
> (typesets ok)
>
>     Let \$X\$ be a subset of.
>
> (postscript error)
>
>     Let \$X\$ be a subset of \$A\$.
>
>
>
> Sometimes slightly rephrasing allows me to go ahead, and then the error pops up again sometime later.
> I am thinking that at some point an out of memory or overflow condition may be happening.
>
> Any hints will be greatly appreciated. I will also post this to the pstricks list, just in case. Is there a more suitable place to ask?
>
> If possible, cc: to me, as I am on digest mode.
>
> TIA
>
> Luis Sequeira
>
> ps:
>
> The error I get is this:
>
> ### /usr/local/bin/ps2pdf14 /tmp/altpdflatex.22757-1350899854/CDI1-texto.ps /tmp/altpdflatex.22757-1350899854/CDI1-texto.pdf
> Error: /undefinedresult in --atan--
> Operand stack:
>  --nostringval--   Alpha   0   0
> Execution stack:
>  %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1894   1   3   %oparray_pop   1893   1   3   %oparray_pop   1877   1   3   %oparray_pop   1771   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--
> Dictionary stack:
>  --dict:1157/1684(ro)(G)--   --dict:0/20(G)--   --dict:153/200(L)--   --dict:206/300(L)--   --dict:112/200(L)--
> Current allocation mode is local
> Last OS error: 2
> Current file position is 1340664
> GPL Ghostscript 9.05: Unrecoverable error, exit code 1
> ### FAILED to generate /tmp/altpdflatex.22757-1350899854/CDI1-texto.pdf ()

Howdy,

The error is occurring when ps2pdf14 is processing the ps file to produce a pdf file so the compile completed and and dvips has already converted the dvi to ps. It says that there is an ``/undefinedresult in --atan--'' which someone else here might understand.

Assuming you have the dvi file can you try to process the dvi file to pdf using dvipdfmx in Terminal? That might show us if it's a problem with ghostscript (called by ps2pdf14) or try to process the ps file using Apple's distiller, pstopdf.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)