From ripley at stats.ox.ac.uk  Thu Jan 19 16:34:17 2006
From: ripley at stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Thu, 19 Jan 2006 16:34:17 +0100 (CET)
Subject: [Rd] Suboptimal EPS output (PR#8502)
Message-ID: <20060119153417.7CFEA19FF2@slim.kubism.ku.dk>

I am unable to reproduce the claimed bug here in R-devel (although I can 
in 2.2.1), and the files are all readable in GSView/gs.

We do ask you to consult the appropriate files and test the current 
versions to see if this has been changed.  As the FAQ says

   If a bug has already been reported or fixed, please do not submit
   further bug reports on it.


I am not sure that the page numbering is inappropriate but it is 
easy to change (pdf() works the way you desire) and I have done so.

On Wed, 18 Jan 2006 mike.prager at noaa.gov wrote:

> Full_Name: Mike Prager
> Version: 2.2.1
> OS: Windows XP with SP2
> Submission from: (NULL) (205.156.36.17)
>
>
> When several EPS files are made with one invocation of postscript(), only the
> first displays correctly in gsview. Examination of the generated eps files with
> a diff utility reveals that subsequent eps files lack the encoding vector
> definition and report page numbers higher than one. This causes (e.g.) gsview to
> fail when trying to display the subsequent files.
>
> My copy of the EPS specification does not prohibit %%Pages DSC comments higher
> than one, but since an EPS file is not allowed to have multiple pages, it seems
> inconsistent at least for the R-generated file to claim to be page 2 or that it
> contains more than one page.

Not for it to claim to be page 2: it does not say it is page 2 in that 
file.

> The lack of encoding vector definition causes font loading to fail when it the
> file later specifies WinAnsiEncoding (as it does by default).
>
> Therefore, it would be desirable for each generated eps file to include the
> encoding vector and to state that it is page 1 of 1 and that the number of pages
> is 1.
>
> (This can be worked around by closing the device between plots, thus making sure
> each EPS file is the first file.)
>
> The following example generates two files, the second of which is incompatible
> with gsview on Windows as described:
>
> ######################################################################
> # epstest.r
> # M. H. Prager
> # Demonstrate (1) possible wrapper function for postscript() and
> #             (2) problems with current EPS output
> # January 17, 2006
> ######################################################################
> eps <- function (...)
> {
>    postscript(height = 5, width = 7, onefile = FALSE, horizontal = FALSE,
>        paper = "special", file = "Rplot%03d.eps", ...)
> }
>
> eps()
> plot(1:5, rnorm(5))
> plot(1:6, rnorm(6))
> dev.off()
> # END OF EXAMPLE
> ######################################################################
>
> In addition, although it is NOT a bug, I would like to request that a wrapper
> function like eps() above be included with the R distribution. This would save
> R-help readers from answering the same questions over and over. It would also
> make it easier for newcomers to use R for generating eps files. Consideration by
> the R Core Team would be appreciated.

The people who do not read the help page also do not do what is suggested 
to them on R-help, so how would this help?  If you really think this is 
an FAQ (as distinct from being asked over and over again by a single 
person), you should submit an FAQ entry on it.

We already provide many simple ways, including menu items, for saving to 
EPS.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Suboptimal EPS output (PR#8502)
ripley@stats.ox.ac.uk