[R] Latex fonts in R graphics

David Winsemius dwinsemius at comcast.net
Sat Sep 11 14:07:24 CEST 2010


On Sep 11, 2010, at 7:18 AM, KARAVASILIS GEORGE wrote:

> Hello, R users.
> I am trying to embed Computer modern fonts to an R plot and I get  
> the following error.
>
> CM <- Type1Font("CM",
> +                  c(paste("cm-lgc/fonts/afm/public/cm-lgc/",
> + c("fcmr8a.afm", "fcmb8a.afm", "fcmri8a.afm", "fcmbi8a.afm"),  
> sep=""),
> + "./cmsyase.afm"))
> > pdf("cm.pdf", width=3, height=3, family="CM")
> > plot(1:length(y), y, xlab="ss", ylab=expression(x[2]))  ## for any  
> vector y
> > dev.off()
> null device
>          1
> > embedFonts("cm.pdf", outfile="cmembed.pdf", fontpaths=c("cm-lgc/ 
> fonts/type1/public/cm-lgc", "."))
> Error in embedFonts("cm.pdf", outfile = "cmembed.pdf", fontpaths =  
> c("cm-lgc/fonts/type1/public/cm-lgc",  :
>  status -1 in running command 'gswin32c.exe -dNOPAUSE -dBATCH -q - 
> dAutoRotatePages=/None -sDEVICE=pdfwrite -sOutputFile=C: 
> \DOCUME~1\user\LOCALS~1\Temp\RtmpccEtgV\Rembed28163716 -sFONTPATH=cm- 
> lgc/fonts/type1/public/cm-lgc;.  cm.pdf'
> In addition: Warning message:
> In system(cmd) : gswin32c.exe not found
>
>
> Operating system: Windows XP, SP2.
> cm-lgc has been unzipped in the working directory  "C:/Program Files/ 
> R/R-2.10.1" and the AFM, PFB files are also in same directory.

The error message is telling us that you do not have Ghostscript  
installed properly. While you are at it, you should probably updated R  
as well.

-- 
David

> Any help?
-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list