[R] Sweave doesn't hand on width of special characters of Computer Modern fonts to LaTeX

Duncan Murdoch murdoch.duncan at gmail.com
Tue Feb 15 23:19:23 CET 2011


On 15/02/2011 4:55 PM, Julia Jacobson wrote:
> Hello R users,
>
> Using R, Sweave and the cmsyase.afm font it is possible to write LaTeX
> documents including R figures with text in the Computer Modern Fonts:

This is very unlikely to have anything to do with Sweave, it's a 
graphics system problem.  You might want to read the article

Paul Murrell and Brian Ripley (2006) Non-standard fonts in PostScript 
and PDF graphics. R News, 6(2):41–47. 
http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf

for information.  It looks as though you did everything it recommends, 
except embedding the fonts:  maybe you need to do that.

Duncan Murdoch

>
> \documentclass{article}
> \usepackage{Sweave}
> \begin{document}
> <<echo = false, results = hide>>=
> CM<- Type1Font("CM",
>          c(file.path("C:/texlive/2009/texmf-dist/fonts/afm/public/cm-lgc",
>          c("fcmr8a.afm", "fcmb8a.afm", "fcmri8a.afm", "fcmbi8a.afm")),
>          "./cmsyase.afm"))
> pdfFonts(CM = CM)
> postscriptFonts(CM = CM)
> pdf.options(family = "CM", pointsize = 11)
> ps.options(family = "CM", pointsize = 11)
> @
> <<fig = true, echo = false, include = true>>=
> x<- c(1,2,3)
> y<- c(1,2,1)
> plot(y~x, xlab = "1 - 3 units")  # The "-" sign here is
> @                                # missing in the PDF file!
> \end{document}
>
> First of all, Sweave doesn't seem to hand on the width of the "-" sign
> on to LaTex, like the warning is indicating.
> Moreover, the font of the text in the graphics looks different from the
> Computer Modern fonts LaTeX is using.
>
> Thanks in advance for your answers,
> Julia
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list