sixelmath
Render LaTeX Math expressions or Sympy objects in the terminal using sixel graphics. Math rendering is done using ziamath, a pure-Python LaTeX math renderer that does not require a Latex installation. Any math-enabled truetype/opentype font may be used; STIXTwoMath-Regular is included and used by default. Also uses cairosvg, timg, and Pillow.
See list of sixel-supported terminal emulators here.
Usage
Command Line
Render a LaTeX expression:
sixelmath "\frac{1}{1+x}"
Options include:
- '-s': Font size in points
- '-f': Path to font file (must include MATH table)
- '-c': Color as a supported named color, or hex value such as
#FFFFFF - '-b': Background color as a supported named color, or hex value such as
#FFFFFF - '-m': Margin width in pixels
In POSIX environments, the font and background color are detected automatically if not manually specified.
Python
To render LaTeX from Python code:
from sixelmath import sixelmath
sixelmath(r'\frac{1}{1+x}')
Keyword arguments may be passed to sixelmath to change options:
color: Font color. A named terminal color like 'white', or RGB hex color such as#FFFFFFbgcolor: Background color.font: Path to a TTF or OTF font file. Must contain a MATH table. STIXTwoMath-Regular is used by default.fontsize: Font size in pixelsmargin: Pixel margin around the euqation
Sympy
Import the sixelmath.sympysixel module to install a Sympy Printer that automatically displays Sympy expressions as sixel graphics.
import sympy
from sixelmath import sympysixel
sympy.sympify('A * exp(-x^2)')
To change display format, use sixelmath.sixel_defaults, with the same keyword arguments listed above for sixelmath.
The sixel printer may be turned off using sympysixel.disable() and turned on with sympysixel.enable().
Metadata
Release files for sixelmath 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sixelmath-0.1.tar.gz | 6.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sixelmath-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.0 kB
Release files / sixelmath-0.1.tar.gz
| Download URL | sixelmath-0.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bbb8b9687e62cd62ae4cf6d0d5551a16fab5913276691b53c670ddd20c77611
|
|
BLAKE2b-256 checksum How to use checksums |
f54ea494845c430d9905982556028f80163f5079bcfe02f313385c65cca0b834
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / sixelmath-0.1-py3-none-any.whl
| Download URL | sixelmath-0.1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5fbaeb416d88eb78ad3bd818b90ce2836ac135bbdca11aad8d1d7d543fdf5e7
|
|
BLAKE2b-256 checksum How to use checksums |
ba94eecb89aa8ceab7527a71d52f5f6f3702e629a36968f4d01e53b3cf9b231a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Security for sixelmath 0.1
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.