[R] Sweave, cm-lgc and minus signs

Bert Stumm tmp.mail.2008 at gmx.de
Tue Aug 4 20:36:29 CEST 2009


Hello,

since a couple of days I'm trying hard to elicit a certain thing
out of the Sweave function of R. Unfortunately I'm quite unsuccessful.

It's only about a small, ridiculous minus sign, which does not appear
in the final pdf of a latex file, if I try to incorporate the Computer-
Modern fonts into the plot. It seems, that R uses different encodings
for minus signs, which are put "by hand" and which are plotted from a
variable with negative value.

###

As a fast example everybody can retrace immediately, there is the nice
example of Paul Murrell which can be found at:
http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html

Essentially, what I need from this page are the following 4 files for 
creating my final pdf:

http://www.stat.auckland.ac.nz/~paul/R/CM/cmTutorial.Rnw

This example needs the according Tex-package and the files for the symbol
faces found at: 
http://www.ctan.org/tex-archive/help/Catalogue/entries/cm-lgc.html 
http://www.stat.auckland.ac.nz/~paul/R/CM/cmsyase.afm
http://www.stat.auckland.ac.nz/~paul/R/CM/cmsyase.pfb

###

Creating the tex-file with
R CMD Sweave cmTutorial.Rnw
(if the 'lattice' package is not loaded immediately then type a 
library(lattice)
in front of the 'print(<<latticeCode>>)'
)

and compiling it with
pdflatex cmTutorial.tex

yields a perfect plot. BUT, if minus signs appear in the plot, it does not
work poperly anymore! Just change the endpoints in the 'histogram' 
function to 'c(-59.5, 76.5)' ( instead of 'c(59.5, 76.5)' ) and run the
two upper commands again. Then, I see a minus sign in the file 
'cmTutorial-latticeShow.pdf' but NOT in the 'cmTutorial.pdf'. 

However, putting sth. like 'mtext("-3.14...",1,-2)' somewhere, I will see
a nice minus sign also in the final plot. But it will look different 
compared to the minus which I can see in 'cmTutorial-latticeShow.pdf'.

###

Can anybody explain me, how to get rid of this problem?
How can pdflatex change something in the included pdf?

Cheers,
Frank





-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser




More information about the R-help mailing list