Skip to main content

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^{-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^{-6}"

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

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

rt.reset_options() # Reset options to default

As an alternative to set_options, the SetOptions context manager can be used to temporarily change the options.

with rt.SetOptions(precision=4, multiply_symbol="*"):
    tex = rt.real2tex(1.2345e-6)
    print(tex) # "1.2345 * 10^{-6}"

Metadata

Release files for real2tex 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for real2tex 2.0.0
File Size Uploaded Provenance Actions
real2tex-2.0.0.tar.gz 15.9 kB Without provenance Details for real2tex-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for real2tex 2.0.0
File Interpreter ABI Platform Actions
real2tex-2.0.0-py3-none-any.whl Python 3 none any Details for real2tex-2.0.0-py3-none-any.whl

Total release size: 31.2 kB

Release files / real2tex-2.0.0.tar.gz

Download URL real2tex-2.0.0.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
be704a1b85ad2b3769bb08f88330d9c25414b27b654764cc727707cf903a9e58
BLAKE2b-256 checksum
How to use checksums
7ed89b778ad06c596baae64d8281a5fa18b6154b15542e1c31dcf2f03b1e92ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / real2tex-2.0.0-py3-none-any.whl

Download URL real2tex-2.0.0-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d60babaad3dd4e0efe8846374eb825aa20fa7dfcf1fd205500d36d02cb5d94e8
BLAKE2b-256 checksum
How to use checksums
995a19225718ff27954bdfac23ad5bc473a2ade5be8b7bef504810e28133decd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for real2tex 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page