Learn R Programming

dafs (version 1.0-38)

formatScientificTeX: Format a number in scientific notation into LaTeX.

Description

Format a number in standard scientific format XXX.XXEXXX into a string that can be typeset by LaTeX

Usage

formatScientificTeX(x, width, digits)

Arguments

x

The number to be formatted. This number does not need to be in scientific format.

width

width and digits are interpreted in the same way that they are for the C function sprintf. The number will be formatted so that it takes x times 10 to the power of y, where x is formatted so that the number has width characters in total (including a decimal point) and digits decimal places.

digits

See width.

Value

A string that will format in a LaTeX inline math environment.

Details

If x = 300.123, width = 4 and digits = 1, then this function will return " 3.0\\times 10^2"

See Also

sprintf

Examples

Run this code
# NOT RUN {
fmtST(300.123, 1, 4)
# }

Run the code above in your browser using DataLab