Skip to content

Giuseppe499/real2tex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

real2tex

real2tex is a Python module that converts a real number to a string of LaTeX code that represents the number in scientific notation.

Installation

pip install real2tex

Usage

from real2tex import real2tex

tex = real2tex(1.2345e-6, precision=2)
print(tex) # "1.23 \cdot 10^{\minus 6}"

Is it also possible to change the default arguments of the module (precision, multiply_symbol, ...) with the set_options function. Furthermore, the current options can be retrieved with the get_options function and reset to the default values with the reset_options function.

import real2tex as rt

tex = rt.real2tex(1.2345e-6)
print(tex) # "1.23 \cdot 10^{\minus 6}"

rt.set_options(precision=4, multiply_symbol="*")
tex = rt.real2tex(1.2345e-6)
print(tex) # "1.2345 * 10^{\minus 6}"

print(rt.get_options()) # Get current options

rt.reset_options() # Reset options to default

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages