[R] problem with minus signs when using postscript/pdf functions with ComputerModernItalic family

dbp dbp at apl.washington.edu
Sat Jul 20 18:05:32 CEST 2013

When I use the postscript with the ComputerModernItalic family, minus signs are not properly displayed, but are changed into capital gammas.   The attached test-postscript.pdf file illustrates the problem, which I created starting with the following R code:

> postscript("test-postscript.eps", family = "ComputerModernItalic")
> plot(seq(-5,5,1),seq(-5,5,1))
> dev.off()

I then created the attached .pdf file from the .eps file using the Preview application on a MacBook Pro (see below for details about my R session).  I have also attempted to create the same plot using the pdf function.  For some reason, pdf does not like `family = "ComputerModernItalic"', so I needed to do the following.

> CMitalic <- Type1Font("ComputerModern2",
+                       c("CM_regular_10.afm", "CM_boldx_10.afm",
+                         "cmti10.afm", "cmbxti10.afm",
+                         "CM_symbol_10.afm"),
+                       encoding = "TeXtext.enc")
> pdf("test-pdf.pdf", family = CMitalic)
> plot(seq(-5,5,1),seq(-5,5,1))
> dev.off()

The attached test-pdf.pdf file shows the minus signs are no longer replaced by capital gammas, but are now blanked out.
   For the record, I noticed this problem several years ago and have been hoping that it would disappear with each new release of R.  At the time that I first noted it, I asked a colleague to run an example on a Windows box, and the same problem occurred, leading me to conclude that the problem is not unique to Mac OS-X.  Any help or workarounds for the problem would be greatly appreciated!  Regards,
- Don Percival

> sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_2.15.3 tools_2.15.3  

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

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

dbp at apl.washington.edu
Applied Physics Laboratory
Box 355640
University of Washington
Seattle, WA 98195-5640
Phones: 206-543-1368      Fax: 206-543-6785

More information about the R-help mailing list