Converts a number to a LaTeX string in scientific notation.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file real2tex-1.0.2.tar.gz.
File metadata
- Download URL: real2tex-1.0.2.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62817bb1dbf9f6f8ed37db47cacdd49b49c20057243e3597c3e6acf8bbda39da
|
|
| MD5 |
2d1eee1ba95681460b2ef39d90b371b2
|
|
| BLAKE2b-256 |
d34eceb12fd284c69f5c883933d077e729861110de03931c9e4fee0c15551346
|
File details
Details for the file real2tex-1.0.2-py3-none-any.whl.
File metadata
- Download URL: real2tex-1.0.2-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea4a845240e8efd41daf29f30a6def319d5610789b0f8dd80bdcfed768f1e346
|
|
| MD5 |
569553d42d00a197fd74141b9849ed27
|
|
| BLAKE2b-256 |
872f616571d78ca4aa27fa53c5ea6f07902c6010e3a85f15a26e4ff1ea66b1f0
|