[R] Sweave doesn't hand on width of special characters of Computer Modern fonts to LaTeX
Erik Iverson
eriki at ccbr.umn.edu
Tue Feb 15 23:07:07 CET 2011
Julia,
While not a direct answer to your question, you may find the
pgfSweave driver/package to be interesting.
http://cran.r-project.org/web/packages/pgfSweave/
Among other things, it uses the tikzDevice package for figures, which
will cause the labels and text to use the same font as in your
LaTeX document.
--Erik
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:
>
> \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