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

Julia Jacobson julia.jacobson at arcor.de
Tue Feb 15 22:55:49 CET 2011


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



More information about the R-help mailing list