I have a document in .Rnw
which I use to produce a .tex
document with kntir. I have a problem with the formula \num{\Sexpr{max(degree)}}
which in R console produce 12598
but after the running knitr in the .tex document becomes \num{\ensuremath{1.2598\times 10^{4}}}
, which create the following error in LaTex:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! siunitx error: "invalid-number"
!
! Invalid numerical input '\protect $\relax 1.2598\times 10^{4}$'.
!
! See the siunitx documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.466 ... & \num{\ensuremath{1.2598\times 10^{4}}}
I am bit puzzled since in the document I have bigger numbers which do not create any problem when compiling.
These are my /siunitx options
%Separate digits with comma (e.g. 1,000,000)
\usepackage[group-separator={,}]{siunitx}
\sisetup{
detect-all,
detect-inline-family=math,
detect-inline-weight=math,
detect-display-math=true}
\ensuremath
is problematic,\times
probably too. Can't you configure R/knitr to output\num{1.2598E4}
(or just1.598E4
for aS
column)?