Skip to main content
# pnglatex
pnglatex, a small program that converts LaTeX snippets to png

## Requiremens

[Python3](https://www.python.org/downloads/)

A LaTeX distribution such as [TeX Live](https://www.tug.org/texlive/) or [MiKTeX](https://miktex.org/)

`pdfcrop, pnmtopng, pdftoppm` You should be able to find those programs in your distro package manager or [Homebrew](https://brew.sh/)

## Install

In your terminal, type:
```
pip install pnglatex
```
On some systems you might need to use `pip3` instead of `pip`

## Usage

pnglatex comes with a simple command line interface.

To use the cli, you can check the help message using:
```
pnglatex -h
```

Here's the help message in full:
```
usage: pnglatex.py [-h] -c "LaTeX string" [-o filename]

pnglatex, a small program that converts latex snippets to png

optional arguments:
-h, --help show this help message and exit
-c "LaTeX string" The LaTeX string to convert
-o filename The output filename.
```

Some examples:

`pnglatex -c "\[\frac{1}{2}\]"`, `pnglatex -c foo -o foo.png`

pnglatex also includes a single function that you can include in your code.

Here's its docstring in full:
```python
def pnglatex(tex_string, output=None):
"""
Produce an png based on a input LaTeX snippet.

@param tex_string: The LaTeX string.
@param output: The output filename. It can also be a pathlib.Path object.
If not provided, this will be randomly generated.

@return: A Path object of the output file
@raises ValueError: If the input is empty of something went wrong with
the image creation.
"""
```

An example usage would be:
```python
from pnglatex import pnglatex

output = pnglatex(r'\[\displaystyle{\sum_{i=0}^{10} 3i}\]', 'output.png')
```

## Licence

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

See [LICENSE](LICENSE) for details.


Metadata

Release files for pnglatex 1.1

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

Source distribution (sdist)

Source distribution for pnglatex 1.1
File Size Uploaded Provenance
pnglatex-1.1.tar.gz 17.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pnglatex 1.1
File Interpreter ABI Platform
pnglatex-1.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 37.7 kB

Release files / pnglatex-1.1.tar.gz

Download URL pnglatex-1.1.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0995060d4926b6d3b40731586c615234c3e45b3142fc15b836601e3b0cf863d3
BLAKE2b-256 checksum
How to use checksums
a10966e828e1d0767a7ba8f3fa157d0be5595ef300967755d61b735dd846bc0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pnglatex-1.1-py2.py3-none-any.whl

Download URL pnglatex-1.1-py2.py3-none-any.whl
Size 19.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8d1d01c59e14ad05ef152194c1bd28f996f0d999b93a67110f24e8be7c0aee20
BLAKE2b-256 checksum
How to use checksums
64bc89bd1b10abd6c6623195d3f81c99679b2cdfe5666f7a8c7b78c7f2aaa8dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pnglatex 1.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.

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files No provenance

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