[R] Sweave scientific real display format (e.g. 5e-12)

Ken Knoblauch knoblauch at lyon.inserm.fr
Fri Mar 10 13:28:51 CET 2006


the third line should have been:
to get that output but I'm missing something about escaping the backslash,
it's missing and when I double it, it doubles.  I think that there has
been some
discussion about this on the list, if you look it up.

How about some variation on the following:

x <- 5e-12
xc <- as.character(x)
xss<-strsplit(xc, "")
paste("$",xss[1],"\cdot ^{",xss[3],xss[4], xss[5],"}$", sep = "")
[1] "$5cdot ^{-12}$"

untried, of course, but maybe you could squeeze something out of it.

Dear All,

I couldn't figure and couldn't google out how to make construct a pair of
\Sexpr s or a LaTeX macro that would include
      5\cdot 10^{-12}
into the LaTeX output istead of
      5e-12 .

Any ideas?

Thank you


Ken Knoblauch
Inserm U371
Cerveau et Vision
Dept. of Cognitive Neuroscience
18 avenue du Doyen Lépine
69500 Bron
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10

More information about the R-help mailing list