Displaying 1 result from an estimated 1 matches for "cdot10".
Did you mean:
cdot
2009 Feb 06
3
Sweave and backslashes
...)","\\\\cdot 10^{-\\1}",x)
x <- gsub("e\\+0([0-9]*)","\\\\cdot 10^{\\1}",x)
x <- gsub("e\\+([0-9]*)","\\\\cdot 10^{\\1}",x)
return(x)
}
Everything works nicely, if I type
> latexNum(4*10^-3)
I get
[1] "4\\cdot10^{-3}"
And the following:
> cat(latexNum(4*10^-3))
Produces:
4\cdot10^{-3}
However the following in a .Rnw file:
$\Sexpr{latexNum(4*10^-3)}$\\
Only produces this in the .tex output file:
$4cdot 10^{-3}$\\
No amount of extra backslashing seems to help. Any idea why my escapes are
not...