formatScientificTeX: Format a number in scientific notation into LaTeX.

View source: R/formatScientificTeX.R

formatScientificTeXR Documentation

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.

Details

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

Value

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

Author(s)

James Curran

See Also

sprintf

Examples

fmtST(300.123, 1, 4)

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