[R] (Somewhat) broken EPS files produced

Marc Schwartz marc_schwartz at me.com
Mon Feb 22 14:10:40 CET 2010


On Feb 21, 2010, at 10:48 PM, Wartan Hachaturow wrote:

> Hello.
> 
> I'm writing some simple text using sweave, and faced a strange problem
> with eps files produced for my plots (one example attached).
> Individual eps files are interpreted by ghostscript just fine, and
> show up without errors. But once I try to include them into main
> LaTeX/Sweave document (using regular \includegraphics, produced by
> Sweave),
> ghostscript gives me this error on those files:
> 
> Error: /undefinedresult in --stringwidth--
> Operand stack:
>   (600)   0.5
> Execution stack:
>   %interp_exit   .runexec2   --nostringval--   --nostringval--
> --nostringval--   2   %stopped_push   --nostringval--
> --nostringval--   --nostringval--   false   1   %stopped_push   1878
> 1   3   %oparray_pop   1877   1   3   %oparray_pop   1861   1   3
> %oparray_pop   1755   1   3   %oparray_pop   --nostringval--
> %errorexec_pop   .runexec2   --nostringval--   --nostringval--
> --nostringval--   2   %stopped_push   --nostringval--
> --nostringval--
> Dictionary stack:
>   --dict:1157/1684(ro)(G)--   --dict:0/20(G)--   --dict:82/200(L)--
> --dict:178/300(L)--   --dict:91/200(L)--
> Current allocation mode is local
> Current file position is 207944
> GPL Ghostscript 8.71: Unrecoverable error, exit code 1
> 
> What might be the problem?
> 
> P.S. I get exactly the same behavior on Debian/sid and OS X.

It would be helpful to attach the .Rnw SWeave file (if small) or post it someplace that we can look at it, along with any data to replicate your process.

I took the EPS file that you provided here, included it in a simple tex file (test.tex) which contains the following:

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}
    \centering
    \includegraphics[width=0.8\textwidth]{Report-fig1}
    \caption{Test Figure}
\end{figure}

\end{document}


I then processed the file using MacTeX (TeXLive on Snow Leopard) with:

latex test.tex
dvips test -o test.ps
ps2pdf test.ps test.pdf

The result is attached here and there were no problems.

I would say that perhaps your GS installation might be corrupted, but that seems less likely on two separate platforms, unless your installation process is common and faulty. Alternatively, there is a problem with your .Rnw file content, since that would be common on both.

That does not give you a specific resolution, but at least suggests that the EPS generation process via SWeave is not at fault.

Regards,

Marc Schwartz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 11088 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100222/4f83577e/attachment.pdf>


More information about the R-help mailing list