R/formatScientificTeX.R

Defines functions fmtST formatScientificTeX

Documented in fmtST formatScientificTeX

formatScientificTeX  = function(x, width, digits){
    exponent = floor(log10(x))

    fmtString = paste('%',width,'.',digits,'f',sep='')

    str1 = sprintf(fmtString, 10^(-exponent)*x)
    str2 = paste('\\\\times 10^{',exponent,'}',sep='')

    return(paste(str1,str2,sep=''))
}

fmtST = function(x, width, digits)
    return(formatScientificTeX(x, width, digits))

Try the dafs package in your browser

Any scripts or data that you put into this service are public.

dafs documentation built on April 11, 2022, 5:06 p.m.