Render LaTeX code to PNG images with transparent background (no math mode required)
Project description
latexit
Render LaTeX math formulas to PNG images from the command line, using pure Python and matplotlib's mathtext engine.
Features
- Pure Python: No system LaTeX required, cross-platform.
- CLI tool: Convert LaTeX math snippets to PNG images.
- Transparent background and customizable DPI, font size, and padding.
Limitations
- Only a subset of LaTeX math is supported (see matplotlib mathtext documentation).
- The output may not look exactly like real LaTeX (TeX/Computer Modern), but you can get close by using the Computer Modern font (see below).
Installation
Option 1 Install via pip
$ pip install latexit
Option 2 Install manually
- Clone the repository:
$ git clone https://github.com/yourusername/latexit.git
$ cd latexit
- Install dependencies:
pip install -r requirements.txt
# or, if using pyproject.toml:
pip install .
Usage
latexit "\\frac{1}{2}" output.png
Options:
--dpi: Set output DPI (default: 300)--fontsize: Set font size (default: 24)--padding: Set padding in pixels (default: 10)
Example
latexit "x^2 + y^2 = z^2" pythagoras.png
License
MIT
Acknowledgments
This project was developed with guidance and code suggestions from an AI assistant Cursor (powered by OpenAI's GPT-4).
Project details
Release history Release notifications | RSS feed
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 latexit-0.2.0.tar.gz.
File metadata
- Download URL: latexit-0.2.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96ef104c2e4a1d0d6161e36a49a4bbc87fa71d4dad4cb3dc6fee47a1ff41ab07
|
|
| MD5 |
8d50fe5e24b1062458341c7a54d7e801
|
|
| BLAKE2b-256 |
c89f5cb7dfa6347bfddcf31ede7dc99782bb7b6c233225008dd8a82f8384f5fd
|
File details
Details for the file latexit-0.2.0-py3-none-any.whl.
File metadata
- Download URL: latexit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a665d0b0109c9b386e652fc1ff7a3bc025afa508d0f7b127af1f26eb476f381f
|
|
| MD5 |
c5b813c770719bed4a3da6d2589d44d9
|
|
| BLAKE2b-256 |
daca22c0eac836f0aaa5056086b2431ed9db498ef2558f268d0abd69f31b5880
|